Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'network' of undefined #50

Closed
AIluffy opened this issue Feb 27, 2017 · 4 comments
Closed

Cannot read property 'network' of undefined #50

AIluffy opened this issue Feb 27, 2017 · 4 comments

Comments

@AIluffy
Copy link

AIluffy commented Feb 27, 2017

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)

@antoniodeluca
Copy link
Owner

Hi @AIluffy. Sorry for the late reply. Checking now.

@antoniodeluca
Copy link
Owner

antoniodeluca commented Mar 1, 2017

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.

@AIluffy
Copy link
Author

AIluffy commented Mar 2, 2017

Hi, @antoniodeluca, thanks for the reply. I did what you told and the example works now.

Hope to see your complete project!

^_^

@antoniodeluca
Copy link
Owner

antoniodeluca commented Mar 12, 2017

Thanks. I close the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants