Skip to content

Commit 9575c8e

Browse files
Documentation
1 parent bb28cd3 commit 9575c8e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [Training](#training)
2020
+ [Data format](#data-format)
2121
+ [For training with NeuralNetwork](#for-training-with-neuralnetwork)
22+
+ [For training with `RNNTimeStep`, `LSTMTimeStep` and `GRUTimeStep`](#for-training-with-rnntimestep-lstmtimestep-and-gputimestep)
2223
+ [For training with `RNN`, `LSTM` and `GRU`](#for-training-with-rnn-lstm-and-gpu)
2324
+ [Training Options](#training-options)
2425
+ [Async Training](#async-training)
@@ -126,6 +127,38 @@ net.train([{input: { r: 0.03, g: 0.7 }, output: { black: 1 }},
126127

127128
var output = net.run({ r: 1, g: 0.4, b: 0 }); // { white: 0.81, black: 0.18 }
128129
```
130+
131+
#### For training with `RNNTimeStep`, `LSTMTimeStep` and `GRUTimeStep`
132+
Eeach training pattern can either:
133+
* Be an array of numbers
134+
* Be an array of arrays of numbers
135+
136+
Example using an array of numbers:
137+
```javascript
138+
var net = new brain.recurrent.LSTMTimeStep();
139+
140+
net.train([
141+
1,
142+
2,
143+
3,
144+
]);
145+
146+
var output = net.run([1, 2]); // 3
147+
```
148+
149+
Example using an array of arrays of numbers:
150+
```javascript
151+
var net = new brain.recurrent.LSTMTimeStep();
152+
153+
net.train([
154+
[1, 3],
155+
[2, 2],
156+
[3, 1],
157+
]);
158+
159+
var output = net.run([[1, 3], [2, 2]]); // [3, 1]
160+
```
161+
129162
#### For training with `RNN`, `LSTM` and `GRU`
130163
Each training pattern can either:
131164
* Be an array of values

0 commit comments

Comments
 (0)