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

Example from the documentation: XOR constantly changes output readings upon restart #954

Open
pihapi opened this issue Jan 29, 2025 · 0 comments
Labels

Comments

@pihapi
Copy link

pihapi commented Jan 29, 2025

const brain = require('brain.js');
// provide optional config object, defaults shown.
const config = {
    inputSize: 20,
    inputRange: 20,
    hiddenLayers: [20, 20],
    outputSize: 20,
    learningRate: 0.01,
    decayRate: 0.999,
};
// create a simple recurrent neural network
const inet = new brain.recurrent.RNN(config);
inet.train([
    { input: [0, 0], output: [0] },
    { input: [0, 1], output: [1] },
    { input: [1, 0], output: [1] },
    { input: [1, 1], output: [0] },
], config);
console.log(inet.run([0, 0])); // [0]
console.log(inet.run([0, 1])); // [1]
console.log(inet.run([1, 0])); // [1]
console.log(inet.run([1, 1])); // [0]
  • output:
1
1
1
1

On Restart
output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

On Restart
output:

0
1
1
0

Version information

Nodejs: v18.12.1

Brain.js: any ( 2.0.0-beta.24, 1.6.1, 1.4.1 )

Other Comments

I have lost all trust in this library!
Maybe I am doing something wrong?

I am currently looking for a similar library to work with nodeJS

@pihapi pihapi added the bug label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant