
Prediction of trends. Stock market, weather predictions, trends, etc. This would be very similar to the existing recurrent net that will be deprecated, but will serve as a baseline for 2.0 GPU push. This will be included in v1 somewhere, as it is a simplification of the existing recurrent network.
5
Usage:
import brain from 'brain.js';
const net = brain.recurrent.RNNTimeStep(options);
// or
const net = brain.recurrent.LSTMTimeStep(options);
// or
const net = brain.recurrent.GRUTimeStep(options);
net.train([
[1,2,3,4,5],
[5,4,3,2,1],
]);
net.run([1,2,3,4]) -> 5
net.run([5,4,3,2]) -> 1
It should be noted that this network type _does not_ work by represented data. This type of neural network will work directly with the data you send in.
@robertleeplummerjr another curiosity, how might one use this approach in aggregation with other time step layers, for example using 3 stocks in the same time period?
I'd like to select a time range of various time step data, I'll have a score applied time step event (say news polarity for example 0.0<->1.0 ), and predict from sets like that?
The more context the net has, the better and I'm not sure that the net would know how to distinguish one from the other. I think it'd be best to train those nets separately. The up-side to that would be each net would be smart enough to tracks its progress, but it would not do well at adjusting based off context of other financials. Example: gold goes up, dollar goes down.
If some sort of non-generalized approach was needed I suppose a custom solution could be built.
The LSTM version (which would be my recommendation to use) uses simple math to achieve its equation: https://github.com/BrainJS/brain.js/blob/develop/src/recurrent/lstm.js#L48 so by modifying that, we may be able to achieve the context you are wishing for.
I thought about this and it hit me this morning, this is already somewhat supported. This is how:
The time step prediction currently only accepts a single value at a time, also it only outputs a single value at a time. By default the network is setup as:
const net = new brain.recurrent.LSTMTimeStep({
inputSize: 1,
hiddenSizes: [20, 20],
outputSize: 1
});
The inputSize represents the single time-step. So, simply make it larger, done. This isn't unit tested, I'll if I can get it supported though.
As for v2, I imagine brain.recurrent.LSTMTimeStep will likely shorten to something like:
import { TimeStep } from 'brain.js';
const net = new TimeStep();
This way the default layer will simply be a runner for whatever layers we want, in this case just rnn, lstm, or gru.
Awesome, keep me posted! Thanks! 馃憤

also tested ^
Thanks! And thanks for the tests, they make it really clear! 馃憤
Most helpful comment
It should be noted that this network type _does not_ work by represented data. This type of neural network will work directly with the data you send in.