+ 6
Cannot Read Property LSTM
Using the recurrent constructor for brain.js, it keeps saying that it doesn't exist despite it working on the GitHub examples. It keeps throwing an error: "Cannot read property LSTM of undefined" How can I fix? https://code.sololearn.com/WJCc0q0DZ5y2/?ref=app
26 odpowiedzi
+ 1
I believe that means that âbrain.recurrentâ is returning undefined, and as such you canât access LSTM of undefined with the statement âbrain.recurrent.LSTMâ. The only conclusion I can draw from this is that âbrainâ has no ârecurrentâ property for whatever reason. Perhaps outdated brain.js? Maybe the example you found on github was outdated? I donât know.
+ 3
Jason Stone Thanks! cdnjs failed me once again so I got the official cdn instead. Although no text ends up showing. It's like the website half loads then gives up
I was told it was going to be slow but I didn't expect the entire website to refuse to load. I've delt with slow codes with slow frame rates which are pretty much unplayable but nothing to this standard. It could be just on my end but I don't know
+ 3
I'll try on my computer and see if it works there. Looks like the program is too big for the servers to handel
+ 3
I don't know, the DOM won't load, only the styling. So I don't know why it won't work
+ 3
I don't know đ I mean no text or content shows up, only the background colors and underlines. Not sure about JS
+ 3
Jason Stone Sorry for not responding, Smash Bros tornament. Yes I agree, even the GitHub said they want to improve it in the future. Thanks for your help
+ 3
Jason Stone Is this right?
https://code.sololearn.com/WJCc0q0DZ5y2/?ref=app
+ 3
Jason Stone It works a lot better, thanks! I wonder if it's only me who's code loads for literally half a minute. Traversy Media said using brain.recurrent.LSTM a guy managed to make a neural network about Tweets. It predicts whether a Tweet was made by Donald Trump or Kim Kardashian.
Waiting that long for each test must have taken the fun out of it
+ 3
It's Sololearn. It's not really known for being the fastest. Like I said, I'll try tommorrow hopefully and check it out there. Phones are no where near as powerful as let's a top of the range, expensive, fast PC with Visual Studio 2019 working its magic. It's sad because if this was successful this would be the code I would be most proud of.
+ 2
huh. Ok. Glad I could help!
+ 2
too big for them to handle? but the web codes arenât run on the servers. I found that with my horribly slow internet every code type except web takes a few seconds just to print âhello, world!â because of the time for signals to travel to and back from the server, but on web console.log prints things instantly.
+ 2
How can the styling style anything if the DOM isnât there to be styled? Do you mean the JS wonât run?
+ 2
If the JS wonât run it could be an infinite loop. I also know that if there is an infinite loop simply going back to the JS or other tab then coming back to the output tab wonât reset it. You have to exit the code entirely and then come back to it. Also, if youâre using an external script make sure to give it time to download.
+ 2
Hmm... background colors and underlines but not even any text. Very strange. In that case Iâll do some testing now.
+ 2
I did a test. I put a couple words in the HTML and leaved the other tabs blank. Worked as expected, the words showed up fine. Then in the JS tab I put âwhile (true) {}â and then wenât back to the output. It was blank. It seems the styles might load but not the text if the JS never terminates.
+ 2
Ok, I gave your code a try and the output section stayed all white, totally blank for 20 seconds straight (there was an alert about painful slowness, so that worked fine)
+ 2
Ok, I did some more testing and after like half a minute or more in the console it said âspamâ so it indeed is VERY painfully slow
+ 2
Changing âwindow.onload=â to âvar main=â and then putting âwindow.onload=()=>{setTimeout(main,1000)}â somewhere gives time for the DOM to load before it runs the main program which takes like half a minute to train the net.
+ 2
Your welcome. Glad I could help!
+ 2
No. I meant:
window.onload=()=>{setTimeout(main, 1000}
var main=()=>{
//code
}
This was it gives the DOM 1000 milliseconds to load before calling the main part of the program