forked from ml5js/ml5-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds basic test for defaults (ml5js#621)
- Loading branch information
Showing
1 changed file
with
56 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,63 @@ | ||
// // Copyright (c) 2019 ml5 | ||
// // | ||
// // This software is released under the MIT License. | ||
// // https://opensource.org/licenses/MIT | ||
// Copyright (c) 2019 ml5 | ||
// | ||
// This software is released under the MIT License. | ||
// https://opensource.org/licenses/MIT | ||
|
||
// const { | ||
// neuralNetwork | ||
// } = ml5; | ||
|
||
// const NN_DEFAULTS = { | ||
// activationHidden: 'sigmoid' | ||
// } | ||
const { | ||
neuralNetwork | ||
} = ml5; | ||
|
||
const NN_DEFAULTS = { | ||
task: 'regression', | ||
activationHidden: 'sigmoid', | ||
activationOutput: 'sigmoid', | ||
debug: false, | ||
learningRate: 0.25, | ||
inputs: 2, | ||
outputs: 1, | ||
noVal: null, | ||
hiddenUnits: 16, | ||
modelMetrics: ['accuracy'], | ||
modelLoss: 'meanSquaredError', | ||
modelOptimizer: null, | ||
batchSize: 64, | ||
epochs: 32, | ||
} | ||
|
||
// describe('neuralNetwork', () => { | ||
// let nn; | ||
|
||
// beforeEach(async () => { | ||
// jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000; | ||
// nn = await neuralNetwork(); | ||
// }); | ||
describe('neuralNetwork', () => { | ||
let nn; | ||
|
||
// it('Should create neuralNetwork with all the defaults', async () => { | ||
// expect(nn.config.activationHidden).toBe(NN_DEFAULTS.activationHidden); | ||
// }); | ||
beforeEach(async () => { | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000; | ||
nn = await neuralNetwork(); | ||
}); | ||
|
||
// }); | ||
it('Should create neuralNetwork with all the defaults', async () => { | ||
expect(nn.config.debug).toBe(NN_DEFAULTS.debug); | ||
// architecture defaults | ||
expect(nn.config.architecture.task).toBe(NN_DEFAULTS.task); | ||
|
||
// expect(nn.config.architecture.layers).toBe(); | ||
// expect(nn.config.architecture.activations).toBe(NN_DEFAULTS.activations); | ||
|
||
// training defaults | ||
expect(nn.config.training.batchSize).toBe(NN_DEFAULTS.batchSize); | ||
expect(nn.config.training.epochs).toBe(NN_DEFAULTS.epochs); | ||
expect(nn.config.training.learningRate).toBe(NN_DEFAULTS.learningRate); | ||
|
||
// expect(nn.config.training.modelMetrics).toBe(NN_DEFAULTS.modelMetrics); | ||
expect(nn.config.training.modelLoss).toBe(NN_DEFAULTS.modelLoss); | ||
// expect(nn.config.training.modelOptimizer).toBe(); | ||
|
||
// data defaults | ||
// expect(nn.config.dataOptions.dataUrl).toBe(); | ||
// expect(nn.config.dataOptions.inputs).toBe(NN_DEFAULTS.inputs); | ||
// expect(nn.config.dataOptions.outputs).toBe(NN_DEFAULTS.outputs); | ||
|
||
// expect(nn.config.dataOptions.normalizationOptions).toBe(); | ||
|
||
}); | ||
|
||
}); |