My Question
I just started learning brain js
and developed a model which gives you category based on the input text
.
I want to ask that each time running the model depends on iterations
greater the number of iterations
the more it will take time but it improves the accuracy
of the model.
Is there any way I can pre-trained
my model so it won't let user to wait for the output.
An example will really help me.
My Code
// JSON file data //
[
{
"text": "my unit test failed",
"category": "software"
},
{
"text": "my driver is working",
"category": "hardware"
}
]
const brain = require('brain.js');
const data = require('./data.json'); //data receiving from json//
const network = new brain.recurrent.LSTM();
const trainingData = data.map(item => ({
input: item.text,
output: item.category
}));
network.train(trainingData, {
log: (error) => console.log(error),
iterations: 1000
});
console.log(network.run('buy me a driver')); // output is Hardware //
Argument of type 'Buffer' is not assignable to parameter of type 'string'
atJSON.parse()
, usereadFileSync().toString()
– Journeyman