I'm using brain JS for predicting some data using 'recurrent LSTM'. I'm using nodeJS,express as the interface to train it and predict output.
Here is some basic training data :
var net = new brain.recurrent.LSTM();
net.train([
{ input: 'I feel great about the world!', output: 'happy' },
{ input: 'The world is a terrible place!', output: 'sad' },
]);
Training Part :
app.get('/learn', function(req, res) {
var params = req.query;
if( params.str !== '' )
{
net.train([
{ input: params.str, output: params.output }
]);
res.send('Training Done');
}
else{
res.send('Nothing to train');
}
});
Output :
app.get('/predict', function(req, res) {
var params = req.query;
if( params.str !== '' )
{
var output = net.run(params.str); // 'happy'
res.send(output);
}
else{
res.send('Nothing to predict');
}
});
Now the issue appears when I'm using any of the following letters anywhere in the string for training or for prediction.
j k m n q v x z
Exact error String :
Error: unrecognized character "q"
at DataFormatter.toIndexes (/var/www/html/brainjs/node_modules/brain.js/dist/utilities/data-formatter.js:85:17)
at DataFormatter.toIndexesInputOutput (/var/www/html/brainjs/node_modules/brain.js/dist/utilities/data-formatter.js:101:23)
at LSTM.formatDataIn (/var/www/html/brainjs/node_modules/brain.js/dist/recurrent/rnn.js:766:35)
at LSTM.run (/var/www/html/brainjs/node_modules/brain.js/dist/recurrent/rnn.js:378:24)
at /var/www/html/brainjs/index.js:56:23
at Layer.handle [as handle_request] (/var/www/html/brainjs/node_modules/express/lib/router/layer.js:95:5)
at next (/var/www/html/brainjs/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/var/www/html/brainjs/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/var/www/html/brainjs/node_modules/express/lib/router/layer.js:95:5)
at /var/www/html/brainjs/node_modules/express/lib/router/index.js:281:22
This is known issue, a fix is in progress. More info: https://github.com/BrainJS/brain.js/issues/217
Try again and let us know if our fix didn't resolve it. Ty again for helping us help you.
Thanks a lot @mubaidr @robertleeplummerjr .
I tested, the issue has been resolved.
Most helpful comment
This is known issue, a fix is in progress. More info: https://github.com/BrainJS/brain.js/issues/217