Train imported model from JSON fails
- Dominant language
- TypeScript
- Stars
- 14.9k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Trying to train an imported model from JSON fails.
Use case:
```typescript
let net = new LSTM();
const trainingData = [
{
input: 'hi',
output: 'mom',
},
{
input: 'howdy',
output: 'dad',
},
{
input: 'hello',
output: 'sis',
},
{
input: 'yo',
output: 'bro',
},
];
net.train(trainingData, { iterations: 20 });
const net2 = new LSTM().fromJSON(net.toJSON());
net2.train(trainingData, { iterations: 20 });
net2.run('hi');
```
Error:
```
Error: Network error rate is unexpected NaN, check network configurations and try again.
Most probably input format is not correct or training data is not enough.
at LSTM.train (brain.js\src\recurrent\rnn.ts:628:15)
```
Fix:
Setting dataFormatter.isSetup to true in DataFormatter.fromJSON solve the problem
```typescript
dataFormatter.isSetup = true;
```
So is there any drawback for this Fix ?
Contributor guide
Assessment
This issue has not been assessed yet.