Skip to content

Commit 16a809f

Browse files
committed
Enhance test reliability by adding retry options to various model tests
1 parent 9bae9ca commit 16a809f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

tests/lib/model/knearestneighbor.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe.each([
116116
'chebyshev',
117117
'minkowski',
118118
(a, b) => a.reduce((s, v, i) => s + Math.exp((v - b[i]) ** 2) - 1, 0),
119-
])('anomaly detection %s', metric => {
119+
])('anomaly detection %s', { retry: 5 }, metric => {
120120
test.each([undefined, 5])('k %j', k => {
121121
const model = new KNNAnomaly(k, metric)
122122
const x = Matrix.randn(100, 2, 0, 0.2).toArray()

tests/lib/model/lvq.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('clustering', () => {
3535
})
3636

3737
describe.each([1, 2, 3])('classification type %i', type => {
38-
test('default', () => {
38+
test('default', { retry: 5 }, () => {
3939
const model = new LVQClassifier(type)
4040
const x = Matrix.concat(Matrix.randn(50, 2, 0, 0.2), Matrix.randn(50, 2, 5, 0.2)).toArray()
4141
x[50] = [0.1, 0.1]

tests/lib/model/nns/layer/graph_sage.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ describe('nn', () => {
255255
}
256256
})
257257

258-
test('grad decay', { timeout: 10000 }, () => {
258+
test('grad decay', { retry: 3, timeout: 30000 }, () => {
259259
const net = NeuralNetwork.fromObject(
260260
[{ type: 'input' }, { type: 'graph_sage', out_size: 3, l2_decay: 0.001 }, { type: 'readout' }],
261261
'mse',

tests/lib/model/nof.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('anomaly detection', () => {
1414
expect(y[y.length - 1]).toBe(true)
1515
})
1616

17-
test('no parameters', () => {
17+
test('no parameters', { retry: 3 }, () => {
1818
const model = new NOF()
1919
const x = Matrix.randn(100, 2, 0, 0.2).toArray()
2020
x.push([10, 10])

0 commit comments

Comments
 (0)