Skip to content

Commit 99fcd3c

Browse files
committed
chore: update dependencies and remove support for Node.js 6
BREAKING CHANGE: Node.js 6 is no longer supported
1 parent 7eb2b77 commit 99fcd3c

16 files changed

+354
-7673
lines changed

.babelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"plugins": ["transform-es2015-modules-commonjs"]
3-
}
2+
"plugins": ["@babel/plugin-transform-modules-commonjs"]
3+
}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22
node_js:
3+
- 12
34
- 10
45
- 8
5-
- 6
66
after_success:
77
- bash <(curl -s https://codecov.io/bash)

Benchmark/.eslintrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parserOptions:
2+
sourceType: script

Benchmark/featureBag.js

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,90 @@
1+
'use strict';
2+
13
var Suite = require('benchmark').Suite;
2-
var Matrix = require('ml-matrix').Matrix;
4+
var { Matrix, MatrixTransposeView } = require('ml-matrix');
35
var Random = require('random-js');
46

57
var data = Matrix.rand(100, 120);
68

79
var suite = new Suite();
810

911
suite
10-
.add('Transposing', function () {
11-
for(var i = 0; i < data.column; ++i) {
12-
fbv1(data, i);
13-
}
14-
})
15-
.add('Get column', function () {
16-
for(var i = 0; i < data.column; ++i) {
17-
fbv2(data, i);
18-
}
19-
}).add("Extra", function () {
20-
for(var i = 0; i < data.column; ++i) {
21-
fbv3(data, i);
22-
}
23-
}).add("Transpose view", function () {
24-
for(var i = 0; i < data.column; ++i) {
25-
fbv4(data, i);
26-
}
27-
})
28-
.on('cycle', function (event) {
29-
console.log(String(event.target));
30-
}).run();
12+
.add('Transposing', function () {
13+
for (var i = 0; i < data.column; ++i) {
14+
fbv1(data, i);
15+
}
16+
})
17+
.add('Get column', function () {
18+
for (var i = 0; i < data.column; ++i) {
19+
fbv2(data, i);
20+
}
21+
}).add('Extra', function () {
22+
for (var i = 0; i < data.column; ++i) {
23+
fbv3(data, i);
24+
}
25+
}).add('Transpose view', function () {
26+
for (var i = 0; i < data.column; ++i) {
27+
fbv4(data, i);
28+
}
29+
})
30+
.on('cycle', function (event) {
31+
console.log(String(event.target));
32+
}).run();
3133

3234
function fbv1(X, n) {
33-
var distribution = Random.integer(0, X.column);
34-
var engine = Random.engines.mt19937().autoSeed();
35+
var distribution = Random.integer(0, X.column);
36+
var engine = Random.MersenneTwister19937.autoSeed();
3537

36-
var Xt = X.transpose();
38+
var Xt = X.transpose();
3739

38-
var toRet = new Array(n);
40+
var toRet = new Array(n);
3941

40-
for(var i = 0; i < n; ++i) {
41-
toRet[i] = Xt[distribution(engine)];
42-
}
42+
for (var i = 0; i < n; ++i) {
43+
toRet[i] = Xt[distribution(engine)];
44+
}
4345

44-
return new Matrix(toRet).transpose();
46+
return new Matrix(toRet).transpose();
4547
}
4648

4749
function fbv2(X, n) {
48-
var distribution = Random.integer(0, X.column);
49-
var engine = Random.engines.mt19937().autoSeed();
50+
var distribution = Random.integer(0, X.column);
51+
var engine = Random.MersenneTwister19937.autoSeed();
5052

51-
var toRet = new Matrix(X.rows, n);
53+
var toRet = new Matrix(X.rows, n);
5254

53-
for(var i = 0; i < n; ++i) {
54-
toRet.setColumn(i, X.getColumn(distribution(engine)));
55-
}
55+
for (var i = 0; i < n; ++i) {
56+
toRet.setColumn(i, X.getColumn(distribution(engine)));
57+
}
5658

57-
return toRet;
59+
return toRet;
5860
}
5961

6062
function fbv3(X, n) {
61-
var distribution = Random.integer(0, X.column);
62-
var engine = Random.engines.mt19937().autoSeed();
63+
var distribution = Random.integer(0, X.column);
64+
var engine = Random.MersenneTwister19937.autoSeed();
6365

64-
var Xt = X.transpose();
66+
var Xt = X.transpose();
6567

66-
var toRet = new Matrix(X.rows, n);
68+
var toRet = new Matrix(X.rows, n);
6769

68-
for(var i = 0; i < n; ++i) {
69-
toRet.setColumn(i, Xt[distribution(engine)]);
70-
}
70+
for (var i = 0; i < n; ++i) {
71+
toRet.setColumn(i, Xt[distribution(engine)]);
72+
}
7173

72-
return toRet;
74+
return toRet;
7375
}
7476

7577
function fbv4(X, n) {
76-
var distribution = Random.integer(0, X.column);
77-
var engine = Random.engines.mt19937().autoSeed();
78+
var distribution = Random.integer(0, X.column);
79+
var engine = Random.MersenneTwister19937.autoSeed();
7880

79-
var Xt = X.transposeView();
81+
var Xt = X.transposeView();
8082

81-
var toRet = new Array(n);
83+
var toRet = new Array(n);
8284

83-
for(var i = 0; i < n; ++i) {
84-
toRet[i] = Xt[distribution(engine)];
85-
}
85+
for (var i = 0; i < n; ++i) {
86+
toRet[i] = Xt[distribution(engine)];
87+
}
8688

87-
return new Matrix(toRet).transposeView();
89+
return new MatrixTransposeView(new Matrix(toRet));
8890
}

Benchmark/predictTranspose.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12

23
var Suite = require('benchmark').Suite;
34
var Matrix = require('ml-matrix').Matrix;
@@ -11,31 +12,31 @@ var suite = new Suite();
1112
ptv1(data);
1213

1314
suite
14-
.add('tranpose', function () {
15-
ptv1(data);
16-
})
17-
.add('transpose view', function () {
18-
ptv2(data);
19-
}).on('cycle', function (event) {
15+
.add('tranpose', function () {
16+
ptv1(data);
17+
})
18+
.add('transpose view', function () {
19+
ptv2(data);
20+
}).on('cycle', function (event) {
2021
console.log(String(event.target));
21-
}).run();
22+
}).run();
2223

2324
function ptv1(X) {
24-
var newData = X.transpose();
25-
var predictions = new Array(newData.length);
26-
for (var i = 0; i < newData.length; ++i) {
27-
predictions[i] = newData[i];
28-
}
25+
var newData = X.transpose();
26+
var predictions = new Array(newData.length);
27+
for (var i = 0; i < newData.length; ++i) {
28+
predictions[i] = newData[i];
29+
}
2930

30-
return predictions;
31+
return predictions;
3132
}
3233

3334
function ptv2(X) {
34-
var newData = X.transposeView();
35-
var predictions = new Array(newData.length);
36-
for (var i = 0; i < newData.length; ++i) {
37-
predictions[i] = newData.getColumn(i);
38-
}
39-
40-
return predictions;
41-
}
35+
var newData = X.transposeView();
36+
var predictions = new Array(newData.length);
37+
for (var i = 0; i < newData.length; ++i) {
38+
predictions[i] = newData.getColumn(i);
39+
}
40+
41+
return predictions;
42+
}

Benchmark/retreiveFeatures.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
1+
'use strict';
2+
13
var Suite = require('benchmark').Suite;
2-
var Matrix = require('ml-matrix').Matrix;
3-
var Random = require('random-js');
4+
var { Matrix, MatrixColumnSelectionView, MatrixTransposeView } = require('ml-matrix');
45

56
var testSize = 120;
67

78
var data = Matrix.rand(100, testSize);
89
var indexes = new Array(testSize);
910

10-
for(var i = 0; i < testSize; ++i) {
11-
indexes[i] = i;
11+
for (var i = 0; i < testSize; ++i) {
12+
indexes[i] = i;
1213
}
1314

1415
var suite = new Suite();
1516

1617
suite
17-
.add('get and set column', function () {
18-
rfv1(data, indexes);
19-
})
20-
.add('Get column', function () {
21-
rfv2(data, indexes);
22-
})
23-
.add('use matrix get column', function () {
24-
rfv3(data, indexes);
25-
})
26-
.on('cycle', function (event) {
27-
console.log(String(event.target));
28-
}).run();
18+
.add('get and set column', function () {
19+
rfv1(data, indexes);
20+
})
21+
.add('Get column', function () {
22+
rfv2(data, indexes);
23+
})
24+
.add('use matrix get column', function () {
25+
rfv3(data, indexes);
26+
})
27+
.on('cycle', function (event) {
28+
console.log(String(event.target));
29+
}).run();
2930

3031
function rfv1(X, indexes) {
31-
var toRet = new Matrix(X.rows, indexes.length);
32-
for (var i = 0; i < indexes.length; ++i) {
33-
toRet.setColumn(i, X.getColumn(indexes[i]));
34-
}
32+
var toRet = new Matrix(X.rows, indexes.length);
33+
for (var i = 0; i < indexes.length; ++i) {
34+
toRet.setColumn(i, X.getColumn(indexes[i]));
35+
}
3536

36-
return toRet;
37+
return toRet;
3738
}
3839

3940
function rfv2(X, indexes) {
40-
var toRet = new Matrix(indexes.length, X.rows);
41-
for(var i = 0; i < indexes.length; ++i) {
42-
toRet[i] = X.getColumn(indexes[i]);
43-
}
44-
return toRet.transposeView();
41+
var toRet = new Matrix(indexes.length, X.rows);
42+
for (var i = 0; i < indexes.length; ++i) {
43+
toRet[i] = X.getColumn(indexes[i]);
44+
}
45+
return new MatrixTransposeView(toRet);
4546
}
4647

4748
function rfv3(X, indexes) {
48-
return X.columnSelectionView(indexes);
49-
}
49+
return new MatrixColumnSelectionView(X, indexes);
50+
}

0 commit comments

Comments
 (0)