Created
January 23, 2021 22:37
-
-
Save george-polevoy/53bce3ccfc7a39717852e9ce62a4ea18 to your computer and use it in GitHub Desktop.
Simple Neural Network routine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double[] FeedForward(double[] inputs) | |
{ | |
for (int i = 0; i < inputs.Length; i++) | |
{ | |
neurons[0][i] = inputs[i]; | |
} | |
for (int i = 1; i < layers.Length; i++) | |
{ | |
for (int j = 0; j < neurons[i].Length; j++) | |
{ | |
double value = 0f; | |
for (int k = 0; k < neurons[i - 1].Length; k++) | |
{ | |
value += weights[i - 1][j][k] * neurons[i - 1][k]; | |
} | |
neurons[i][j] = activate(i, value + biases[i][j]); | |
} | |
} | |
return neurons[neurons.Length - 1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment