synaptic icon indicating copy to clipboard operation
synaptic copied to clipboard

trainAsync syntax error

Open boyanyankov opened this issue 7 years ago • 1 comments

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 });

boyanyankov avatar Dec 24 '17 09:12 boyanyankov

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.

wagenaartje avatar Dec 24 '17 12:12 wagenaartje