File tree 2 files changed +6
-1
lines changed 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1500,14 +1500,15 @@ export class Matrix {
1500
1500
/**
1501
1501
* Shuffle values along the axis.
1502
1502
* @param {number } [axis=0]
1503
+ * @returns {number[] } Original index.
1503
1504
*/
1504
1505
shuffle ( axis = 0 ) {
1505
1506
const idx = [ ]
1506
1507
for ( let i = 0 ; i < this . _size [ axis ] ; i ++ ) {
1507
1508
idx [ i ] = i
1508
1509
}
1509
1510
for ( let i = idx . length - 1 ; i > 0 ; i -- ) {
1510
- let r = Math . floor ( Math . random ( ) * ( i + 1 ) )
1511
+ const r = Math . floor ( Math . random ( ) * ( i + 1 ) )
1511
1512
; [ idx [ i ] , idx [ r ] ] = [ idx [ r ] , idx [ i ] ]
1512
1513
}
1513
1514
@@ -1516,6 +1517,7 @@ export class Matrix {
1516
1517
} else if ( axis === 1 ) {
1517
1518
this . _value = this . col ( idx ) . _value
1518
1519
}
1520
+ return idx
1519
1521
}
1520
1522
1521
1523
/**
Original file line number Diff line number Diff line change
1
+ import { jest } from '@jest/globals'
2
+ jest . retryTimes ( 3 )
3
+
1
4
import { Matrix } from '../../../lib/util/math.js'
2
5
import { ConfidenceWeighted , SoftConfidenceWeighted } from '../../../lib/model/confidence_weighted.js'
3
6
You can’t perform that action at this time.
0 commit comments