Cannot read property 'network' of undefined
AIluffy opened this issue · 4 comments
My System is Win10 and my terminal is powershell.
The node version I use is v6.9.2 and npm version is 3.10.9
When I ran the last example, my terminal shows the message below:
E:\dn2\node_modules\dn2a\built\cerebrum.js:94
}).network;
^
TypeError: Cannot read property 'network' of undefined
at Object.trainMind (E:\dn2\node_modules\dn2a\built\cerebrum.js:94:11)
at Object. (E:\dn2\xor3.js:58:10)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
Hi @AIluffy. Sorry for the late reply. Checking now.
Hi @AIluffy. The problem is relative to a change in the trainMind and queryMind signatures. They support now two additional parameters that enable the user to send callbacks that will be called at each iteration or at each series of iterations (an epoch).
The new signatures are:
trainMind: function(
trainingPatterns,
epochCallback,
iterationCallback,
mindName = "defaultMind"
) {}
queryMind: function(
queryingPatterns,
epochCallback,
iterationCallback,
mindName = "defaultMind"
) {}
You need to pass a function (or maybe an empty function or null) as the epochCallback parameter as well as the iterationCallback one.
These functions then, if passed, are called and a trainingStatus object or a queryingStatus object is passed to them (depending on which case we are talking about: trainMind or queryMind).
The trainingStatus and the queryingStatus objects are useful to monitor the learning process. You can console.log() them to see what they contain but generically speaking they bring all the values about the ongoing error, the iteration number etc.
Just as an example you can find below how the trainMind call of the last example should look like:
cerebrum.trainMind(trainingPatterns, function(trainingStatus) {
console.log("Epoch: " + trainingStatus.elapsedEpochCounter);
}, function() {}, "firstNeuralNetwork");
You can see that before the mind name ("firstNeuralNetwork") there should be an empty function (it could be a null too). It could obviously be a useful function like the previous one.
Hope that this helps you.
I will update the documentation soon.
Hi, @antoniodeluca, thanks for the reply. I did what you told and the example works now.
Hope to see your complete project!
^_^
Thanks. I close the issue now.