synaptic
synaptic copied to clipboard
trainAsync syntax error
I tried the examples and enjoy testing this library -thanks for it.
When I tried trainAsync, it gives me a syntax error: ReferenceError: assignment to undeclared variable costFunction[Learn More] costFunction = 'var cost = ' + (options && options.cost || this.cost || _Trainer2.default.cost.MSE) + ';\n';
Code:
myTrainer.trainAsync(trainingSet,{ rate: .1, iterations: 200, error: .01, shuffle: true, log: 100, cost: Trainer.cost.CROSS_ENTROPY }).then(results => console.log('done!', results));
It works with the regular train. Code:
var trainingResult = myTrainer.train(trainingSet,{ rate: .1, iterations: 200, error: .01, shuffle: true, log: 100, cost: Trainer.cost.CROSS_ENTROPY });
I think this is because you are running the JavaScript in strict
mode. Try running it in non-strict mode to see if it still throws an error. It's weird, because it seems to be a declared variable in the source.