You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,8 @@
20
20
+[Browser](#browser)
21
21
-[Training](#training)
22
22
+[Data format](#data-format)
23
+
+[For training with NeuralNetwork](#for-training-with-neuralnetwork)
24
+
+[For training with `RNN`, `LSTM` and `GRU`](#for-training-with-rnn-lstm-and-gpu)
23
25
+[Training Options](#training-options)
24
26
+[Async Training](#async-training)
25
27
-[Methods](#methods)
@@ -106,6 +108,7 @@ Use `train()` to train the network with an array of training data. The network h
106
108
at classifying new patterns.
107
109
108
110
### Data format
111
+
#### For training with `NeuralNetwork`
109
112
Each training pattern should have an `input` and an `output`, both of which can be either an array of numbers from `0` to `1` or a hash of numbers from `0` to `1`. For the [color contrast demo](https://brain.js.org/) it looks something like this:
* Either of which can an array of values or a string
137
+
138
+
CAUTION: When using an array of values, you can use ANY value, however, the values are represented in the neural network by a single input. So the more _distinct values_ has _the larger your input layer_. If you have a hundreds, thousands, or millions of floating point values _THIS IS NOT THE RIGHT CLASS FOR THE JOB_. Also, when deviating from strings, this gets into beta
139
+
140
+
Example using direct strings:
141
+
```javascript
142
+
var net =newbrain.recurrent.LSTM();
143
+
144
+
net.train([
145
+
'doe, a deer, a female deer',
146
+
'ray, a drop of golden sun',
147
+
'me, a name I call myself',
148
+
]);
149
+
150
+
var output =net.run('doe'); // ', a deer, a female deer'
151
+
```
152
+
153
+
Example using strings with inputs and outputs:
154
+
```javascript
155
+
var net =newbrain.recurrent.LSTM();
156
+
157
+
net.train([
158
+
{ input:'I feel great about the world!', output:'happy' },
159
+
{ input:'The world is a terrible place!', output:'sad' },
160
+
]);
161
+
162
+
var output =net.run('I feel great about the world!'); // 'happy'
0 commit comments