sam: begin demi of different length.
This commit is contained in:
parent
963996b06b
commit
4312ee1116
1 changed files with 12 additions and 6 deletions
|
@ -94,13 +94,16 @@ class NeuralNetwork {
|
|||
// Example usage:
|
||||
|
||||
// Example dataset (XOR problem)
|
||||
let strings = ["hello", "neural", "world"]
|
||||
let strings = ["hello", "neural", "world", "how are", "you", "?"]
|
||||
|
||||
let inputs = [
|
||||
[0, 0, 0],
|
||||
[1, 0, 0],
|
||||
[1, 0, 1],
|
||||
[1, 1, 1]
|
||||
[0, 0, 0, 0, 0 ,0],
|
||||
[1, 0, 0, 0, 0, 0],
|
||||
[1, 0, 1, 0, 0, 0],
|
||||
[1, 1, 1, 0, 0, 0],
|
||||
[1, 1, 1, 0, 1, 0],
|
||||
[1, 1, 1, 0, 1, 1],
|
||||
[1, 1, 1, 1, 1, 1]
|
||||
];
|
||||
|
||||
let nn = new NeuralNetwork(strings.length, inputs.length, 1); // Increased hidden nodes to 4
|
||||
|
@ -109,7 +112,10 @@ let targets = [
|
|||
[0],
|
||||
[1],
|
||||
[2],
|
||||
[3]
|
||||
[3],
|
||||
[4],
|
||||
[5],
|
||||
[6]
|
||||
];
|
||||
|
||||
if (targets.length != inputs.length) {
|
||||
|
|
Loading…
Reference in a new issue