sam: begin demi of different length.

This commit is contained in:
The Ghost of FOSS' Past 2024-12-03 23:10:23 +00:00
parent 963996b06b
commit 4312ee1116

View file

@ -94,13 +94,16 @@ class NeuralNetwork {
// Example usage: // Example usage:
// Example dataset (XOR problem) // Example dataset (XOR problem)
let strings = ["hello", "neural", "world"] let strings = ["hello", "neural", "world", "how are", "you", "?"]
let inputs = [ let inputs = [
[0, 0, 0], [0, 0, 0, 0, 0 ,0],
[1, 0, 0], [1, 0, 0, 0, 0, 0],
[1, 0, 1], [1, 0, 1, 0, 0, 0],
[1, 1, 1] [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 let nn = new NeuralNetwork(strings.length, inputs.length, 1); // Increased hidden nodes to 4
@ -109,7 +112,10 @@ let targets = [
[0], [0],
[1], [1],
[2], [2],
[3] [3],
[4],
[5],
[6]
]; ];
if (targets.length != inputs.length) { if (targets.length != inputs.length) {