/// <summary> /// Creates a new Neural Network /// </summary> /// <param name="_inputs">number of inputs</param> /// <param name="_outputs">number of output</param> /// <param name="_hiddenNodes">number of neurons per hidden layer</param> public NeuralNetwork(int _inputs, int _hiddenNodes, int _outputs, int _numHiddenLayers = 1) { inputs = _inputs; outputs = _outputs; hiddenNodes = _hiddenNodes; numHiddenLayers = _numHiddenLayers; // matrix of weights to use with layers weightMatrixes = new List <MatrixF>(); weightMatrixes.Add(MatrixF.RandomMatrix(hiddenNodes, inputs)); for (int i = 0; i < _numHiddenLayers - 1; i++) { weightMatrixes.Add(MatrixF.RandomMatrix(hiddenNodes, hiddenNodes)); } weightMatrixes.Add(MatrixF.RandomMatrix(outputs, hiddenNodes)); // very tall matrix of bias to use with layers biasMatrixes = new List <MatrixF>(); for (int i = 0; i < _numHiddenLayers; i++) { biasMatrixes.Add(MatrixF.RandomMatrix(hiddenNodes, 1)); } biasMatrixes.Add(MatrixF.RandomMatrix(outputs, 1)); }