-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
What is wrong?
I can get the toy examples working like the happy, sad example on the documentation. But when I increase the length of the sentence, I start getting blank strings as output "". Through experimentation it seems to have to do with sentence length and happens at around 100 characters.
Where does it happen?
running node 10.7 on pc and mac
How do we replicate the issue?
run this code as is to see working example.
Then swap out the commented variable happySentence
and see that the outputs become blank string
The callback outputs will start to get the right answer really quickly; around 150 iterations. But nothing ever gets output in the longer sentence, even when approaching tens of thousands of iterations
const net = new brain.recurrent.GRU();
const happySentence = "is upset that he can't update his Facebook by texting it... and might cry as a result School"
// const happySentence = 'is upset that he can\'t update his Facebook by texting it... and might cry as a result School Today'
console.log(happySentence.length)
const sadSentence = 'im meeting up with one of my besties tonight! Cant wait!! - GIRL TALK!!'
net.train([
{input: happySentence, output: [1]},
{input: sadSentence, output: [0]},
],
{
iterations: 20000, // the maximum times to iterate the training data --> number greater than 0
errorThresh: 0.005, // the acceptable error percentage from training data --> number between 0 and 1
log: true, // true to use console.log, when a function is supplied it is used --> Either true or a function
logPeriod: 25, // iterations between logging out --> number greater than 0
learningRate: .1, // scales with delta to effect training rate --> number between 0 and 1
momentum: .1, // scales with next layer's change value --> number between 0 and 1
callback: function(){
console.log(net.run(happySentence))
}, // a periodic call back that can be triggered while training --> null or function
callbackPeriod: 25, // the number of iterations through the training data between callback calls --> number greater than 0
timeout: Infinity // the max number of milliseconds to train for --> number greater than 0
});
const output = net.run(happySentence);
expect(output).equal(1)
How important is this (1-5)?
5 because it doesn't work
Expected behavior (i.e. solution)
the output of either versions of happySentence
should have been 1
Other Comments
ewliang