cazala / synaptic

architecture-free neural network library for node.js and the browser
http://caza.la/synaptic
Other
6.91k stars 666 forks source link

log and schedule not working as antipated. #260

Closed BRD-E closed 6 years ago

BRD-E commented 6 years ago

var TrainerSettings = { rate: .1, iterations: 20000, error: .00000000005, shuffle: true, log: 100, cost: Trainer.cost.CROSS_ENTROPY, schedule: { every: 500, // repeat this task every 500 iterations do: function(data) { // custom log console.log("error", data.error, "iterations", data.iterations, "rate", data.rate); if (someCondition) return true; // abort/stop training } } } myPerceptron = new Perceptron(2,4,1); var myTrainer = new Trainer(myPerceptron, TrainerSettings); console.log(myTrainer) console.log(myTrainer.XOR()); // { error: 0.004998819355993572, iterations: 21871, time: 356 } I thought every 100 iterations, it would display { error: 0.004998819355993572, iterations: 21871, time: 356 }`for the log option

For the schedule option, it should read off something like "error", data.error, "iterations", data.iterations, "rate", data.rate every 500 iterations.

Am I using this wrong? Is this a known bug? Any idea how I could get this working? Thank you for your time.

wagenaartje commented 6 years ago

You are not using Trainer as supposed. Please read through the wiki here and come back for any questions:

https://github.com/cazala/synaptic/wiki/Trainer

A trainer is an object, so you have to start training it with myTrainer.train(dataSet, options).

stumpdk commented 6 years ago

You have to start the trainer using the "train" method: myTrainer.train(dataSet, options)