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

Bug Report with 1.0.12 #234

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello All,

is there something we need to change in our code with 1.0.12 ?

I get this error with the latest version which works perfectly fine with the previous version of Synaptic ..

node_chakra fx_binary.js 10 10 1 7 10

TypeError: Unable to get property 'input' of undefined or null reference - Real Trades: 1 - All Buy/Sell: 0:1 - Dataset: 1 - 10.00% at Trainer.prototype._trainSet (C:\Dropbox\Forex\Test2\trainer.js:144:7) at Trainer.prototype.train (C:\Dropbox\Forex\Test2\trainer.js:99:9) at Anonymous function (C:\Dropbox\Forex\Test2\fx_binary.js:317:9) at Module.prototype._compile (module.js:569:5) at Module._extensions[.js] (module.js:580:3) at Module.prototype.load (module.js:503:3) at tryModuleLoad (module.js:466:5) at Module._load (module.js:458:3) at Module.runMain (module.js:605:3) at startup (bootstrap_node.js:146:9)

wagenaartje commented 7 years ago

Hi, from where are you running this code? Could you give a little more information about your dataset (a sample if possible). It seems like it has problems with reading the dataset.

ghost commented 7 years ago

Sure, here we go :)

http://wikisend.com/download/409398/Bugs.zip

I sense the issue is that I create arrays of networks, trainers and datasets (to simulate swarms of networks), and that somehow breaks on the latest version.

I run from commandline in Windows, issue is with Node V8 or Node Chakra.

wagenaartje commented 7 years ago

Ill have a look at it asap; it might be tomorrow morning though.

ghost commented 7 years ago

Thanks ! :)

Its somewhere around here:

trainer.js:144:25 var input = set[i].input;

with this command line it works using 1 dataset for training: node test.js 10 10 1 7 1 (last digit defines amount of trainingsets)

if set to 2 it fails:

$ node test.js 10 10 1 7 1 Time: 420 - Network: 10-10-1-7-1 - Prediction: 100.00% / Real: 100.00% - Real Trades: 1 - All Buy/Sell: 0:1 - Dataset: 1 - 100.00% { neurons: 95, connections: 2249 }

cool, no error and all complete !

$ node test.js 10 10 1 7 2 C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\trainer.js:14400% - Real Trades: 1 - All Buy/Sell: 0:1 - Dataset: 1 - 50.00% var input = set[i].input; ^

TypeError: Cannot read property 'input' of undefined at Trainer._trainSet (C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\trainer.js:144:25) at Trainer.train (C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\trainer.js:99:23) at Object. (C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\test.js:134:17) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.runMain (module.js:605:10) at run (bootstrap_node.js:427:7)

wagenaartje commented 7 years ago

Hi, I just tried to reply but my PC crashed. So this is sent from mobile

Basically, the bug is not on Synaptics side. Your datasets make no sense. I console logged your dataset and it containd empty indices, something like this [,sample] (notice the comma). So if you run array[0] it will return undefined.

Other than that, your sample input also contains undefined numerous times.

Log your dataset and you will see what I mean.

ghost commented 7 years ago

Thanks for spotting this, fixed the ,,, in the dataset and its still the same. However I will rewrite my dataset code now, I am sure the bug is on my side somewhere in a loop that went wrong. Good thing is that "1.0.12" is more n00b safe now lol

$ node test.js 10 10 1 7 2 Dataset Columns found: 14

Inputs Set: 0.0630788346438211,0.0613819538211346,0.0604595838929312,0.0599599061704661,0.0596873027763953,0.0595527672665196,0.0600809794533795,0.0627906113306865,0.0654591098880041,0.0646348369881978,0.0629513850738582,0.0617468685074567,0.0694629898520236,0.0735938635444714 Target Set: 0.0001

Inputs Set: 0.0630788346438211,0.0613819538211346,0.0604595838929312,0.0599599061704661,0.0596873027763953,0.0595527672665196,0.0600809794533795,0.0627906113306865,0.0654591098880041,0.0646348369881978,0.0629513850738582,0.0617468685074567,0.0694629898520236,0.0735938635444714 Target Set: 0.0001

Inputs Set: 0.0630788346438211,0.0613819538211346,0.0604595838929312,0.0599599061704661,0.0596873027763953,0.0595527672665196,0.0600809794533795,0.0627906113306865,0.0654591098880041,0.0646348369881978,0.0629513850738582,0.0617468685074567,0.0694629898520236,0.0735938635444714 Target Set: 0.0001

C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\trainer.js:14800% - Real Trades: 1 - All Buy/Sell: 0:1 - Dataset: 1 - 50.00% console.log("Inputs Set: " + set[i].input); ^

TypeError: Cannot read property 'input' of undefined at Trainer._trainSet (C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\trainer.js:148:42) at Trainer.train (C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\trainer.js:99:23) at Object. (C:\Users\Administrator\Desktop\Bugs\Bugs\Test 1.0.12\test.js:133:17) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.runMain (module.js:605:10) at run (bootstrap_node.js:427:7)

wagenaartje commented 7 years ago

Yeah it is kind of more noob safe :D. The for loop was changed. In 1.0.11 it used to skip undefined properties but that should not be the case (it slows the for loop time by 97%).

If you get stuck on fixing your dataset creation, im always available for help.