I use setting, where itteration 99999 and errorTresh 0.0001, but I get default
node 10.15.2 (because if I use nodejs v12.16.2 I get error)
brain.js 2.0.0-alpha.12 (in [email protected] i dont have this error)
const brain = require('brain.js')
const config = {
iterations: 99999,
errorThresh: 0.0001,
binaryThresh: 0.05,
hiddenLayers: [8,8],
activation: 'sigmoid',
leakyReluAlpha: 0.01,
}
const net = new brain.NeuralNetwork(config)
var trainData = [{input: [0, 0], output: [0]},
{input: [0, 1], output: [1]},
{input: [1, 0], output: [1]},
{input: [1, 1], output: [0]}]
net.train(trainData)
const output = net.run([1, 0])
console.log(output)
// Float32Array [ 0.6636456251144409 ]
console.log(net.train(trainData))
// { error: 0.1692930464156314, iterations: 20000 }
In order for the settings to work, you probably need to use nodejs, but it gives an error.
Error: The module '/home/r/pr/nodeJS/Brain_2/node_modules/gl/build/Release/webgl.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, usingnpm rebuildornpm install).
5
Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.90. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Please do not use inappropriate images, this project is used by many people and children.
We can look at this sometime this week.
I update nodejs. Now:
nodejs -v -> v14.5.0
The error that I wrote about above, I was able to solve.
The same mistake:
Error: The module '/home/r/pr/nodeJS/Brain_2/node_modules/gl/build/Release/webgl.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
I install gl, and replace file _webgl.node_.
I.e.:
1) npm install gl
2) in folder: node_modules/gl/build/Release copy file _webgl.node_ and past in /home/r/pr/nodeJS/Brain_2/node_modules/gl/build/Release/
this folder was indicated in the error that is written above
now I can use
_nodejs xor.js_ instead _node xor.js_
and I still get the default settings and all the same the most 20000 iterations
nodejs xor_test.js
Float32Array(1) [ 0.6637753248214722 ]
{ error: 0.16928909979219278, iterations: 20000 }
What am I doing wrong?
We can look at this sometime this week.
When?
I have installed a new version. The error persisted.
I have this error in -> [email protected] and -> brain.[email protected]
What am I doing wrong?
You shouldn't need to move anything around, the error message is telling you how to resolve the problem. You need to run npm rebuild, the GPU parts need to compile is all (even though they aren't used by this particular class).
When I run the following:
const brain = require('brain.js')
const config = {
iterations: 99999,
errorThresh: 0.0001,
binaryThresh: 0.05,
hiddenLayers: [8,8],
activation: 'sigmoid',
leakyReluAlpha: 0.01,
}
const net = new brain.NeuralNetwork(config)
var trainData = [{input: [0, 0], output: [0]},
{input: [0, 1], output: [1]},
{input: [1, 0], output: [1]},
{input: [1, 1], output: [0]}]
net.train(trainData, { log: true, iterations: 10 })
const output = net.run([1, 0])
console.log(output)
console.log(net.train(trainData, { log: true, iterations: 10 }))
I got the following:
% node test.js
iterations: 10, training error: 0.26401024156751696
Float32Array(1) [ 0.4928584694862366 ]
iterations: 10, training error: 0.26381210602520366
{ error: 0.26381210602520366, iterations: 10 }
Which I believe is the expected output. I did get the same error that you got when using nvm, and running npm rebuild did resolve it for me. I'm going to go ahead and mark this solved because I was able to reproduce and fix by following the recommendation from npm's error.
net.train(trainData, { log: true, iterations: 10 })
Why you use 10 iterations?
Program doesn't work if iterations more than 20000. In this case, it stops at 20,000 iterations, just like nothing is set in the settings.
const config = {
iterations: 99999,
errorThresh: 0.0001,
binaryThresh: 0.05,
hiddenLayers: [8,8],
activation: 'sigmoid',
leakyReluAlpha: 0.01,
}
// { error: 0.1692930464156314, iterations: 20000 }
Was 99999, get 20000
Ah, ty for clarifying.
Fixed in beta 2. Ty for your help in finding this and fixing it!