Why it didn't work? I tried set sents in [], same problem
Can anyone show example how make simple chat bot?
var brain = require('brain.js');
var net = new brain.recurrent.LSTM();
net.train([
{input: "hello", output: "Hi!"},
{input: "How are you?", output: "Super!"},
{input: "Where are you?", output: "Next to you"}
], { log: true });
console.log(net.run("Hello!"));
Sometimes it crash with errors like
Error: unrecognized character "Hello!"
at DataFormatter.toIndexes (/home/node/neural/node_modules/brain.js/dist/utilities/data-formatter.js:85:17)
at DataFormatter.toIndexesInputOutput (/home/node/neural/node_modules/brain.js/dist/utilities/data-formatter.js:103:23)
at LSTM.formatDataIn (/home/node/neural/node_modules/brain.js/dist/recurrent/rnn.js:769:35)
at LSTM.run (/home/node/neural/node_modules/brain.js/dist/recurrent/rnn.js:381:24)
at Object.(/home/node/neural/index.js:9:17)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
Sorry for my bad English
This is because in thestring Hello! is not equal or similar to hello. The neural network is "case-sensitive"
We really need to handle the case of a generic non-understood value so that the net can essentially just skip that value.
I'm working on v2 stuff, anyone want to try and handle this?
Can I? 馃敘
What needs to happen: The formatter just needs an extra character detection.
The formatter: https://github.com/BrainJS/brain.js/blob/master/src/utilities/data-formatter.js
The exception being thrown: https://github.com/BrainJS/brain.js/blob/88b0dda9429653d0d688a8ecadb2952be703e70a/src/utilities/data-formatter.js#L63
We simply just want to use a general character for cases the character isn't understood.
If you allow me to suggest one more thing to be changed/added(which would help making a chatbot, so kinda the topic of the post... right?): It would be interesting to be able to train new data to the NN, without having to train everything again, as it may cost performance
I agree, this should be solved soon.
@robertleeplummerjr Faced the issue too. Will appreciate a fix :+1:
Anybody want to review?: https://github.com/BrainJS/brain.js/pull/241
Try again and let us know, this should be resolved now at least for using strings directly.
Most helpful comment
We really need to handle the case of a generic non-understood value so that the net can essentially just skip that value.