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

Weird bug with brain.js #948

Open
DrFrankxio opened this issue Dec 30, 2024 · 0 comments
Open

Weird bug with brain.js #948

DrFrankxio opened this issue Dec 30, 2024 · 0 comments
Labels

Comments

@DrFrankxio
Copy link

The error is this:

brain-browser.js:41191 Uncaught TypeError: Cannot read properties of null (reading 'equations')
at LSTM.get (brain-browser.js:41191:22)
at LSTM.run (brain-browser.js:40778:17)
at perceptron.html:37:16

And my code is this:

<script src="https://cdnjs.cloudflare.com/ajax/libs/brain.js/2.0.0-beta.1/brain-browser.js" integrity="sha512-bI0AOBSlsQUR/VlZhVj6PuYqjQFO4YTD6Fpw2UBEGC+QkZWLiDgiFZpDefJFnS+ptTjiwZS30VsaF5vJtkQCGw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

[0,0]=><input id="t1"value="1">=>Result:[0,0]=>

[0,1]=><input id="t2"value="1">=>Result:[0,1]=>

[1,0]=><input id="t3"value="1">=>Result:[1,0]=>

[1,1]=><input id="t4"value="1">=>Result:[1,1]=>

<script> const net = new brain.recurrent.LSTM({ inputSize: 2, hiddenLayers: [ { size: 4 }, { size: 2 } ], outputSize: 1 }); render = () => { net.train( [ { input: [0, 0], output: [parseFloat(t1)] }, { input: [0, 1], output: [parseFloat(t2)] }, { input: [1, 0], output: [parseFloat(t3)] }, { input: [1, 1], output: [parseFloat(t4)] }, ], { iterations: 100, // Reducir iteraciones para mayor velocidad log: true, logPeriod: 100, errorThresh: 0.005, } ); isTrained = true; status.textContent = "Training complete!"; updateResults(); } // Permitir al navegador procesar mientras entrena r1.value = net.run({input: [0, 0]}); r2.value = net.run({input: [0, 1]}); r3.value = net.run({input: [1, 0]}); r4.value = net.run({input: [1, 1]}); requestAnimationFrame(render) render() </script>

So, i want all inputs get the same value at each row.

@DrFrankxio DrFrankxio added the bug label Dec 30, 2024
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