BrainJS / BrainJS/brain.js

Best way to train and test LSTMTimeStep network with array of floating point numbers?

Open
#860 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

So I have an array of numbers like this (~150 distinct numbers):
```
[ 307.655296, 308.34, 308.62, 308.0020728, 308.0799444, 307.835, 307.72921, 307.899735, ...]
```
My goal is to be able to predict the next number in the sequence. But I'm unsure how many input numbers are ideal to get the best result :thinking:

For training, I:
1. Normalize array so each value is `< 1`
2. Initiate network: `const net = new brain.recurrent.LSTMTimeStep(netOptions)`
3. Train network: `net.train(trainArray, trainingOptions)`
4. Get to a low `training error` of `~0.001`

But now when I run `net.run(testArray)` I don't know how many values in the `testArray` are needed? 1, 2, 4, ... 10, etc? It seems like the more numbers the better, but I'm not sure what the rule of thumb is, or the proper way to go about this.

For example, even using `6` values from the `trainArray` in the `testArray` I only get about `60%` accurate results.

Thanks in advance!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.