/// <summary> /// Create a neural network. /// </summary> /// <param name="input">the input layer</param> /// <param name="output">the output layer</param> /// <param name="hidden">the hidden layers</param> public NeuralNetwork(NetworkProperties properties, Layer input, Layer output, params Layer[] hidden) { Properties = properties; Input = input; Output = output; Hidden = hidden; }
/// <summary> /// Create a neural network from a series of numbers. /// The first number represents the size of the input layer, the last number is the size of the output layer. /// The numbers inbetween are the sizes of the hidden layers. /// </summary> /// <param name="architecture">the sizes of the layers</param> public NeuralNetwork(NetworkProperties properties, params int[] architecture) { int l = architecture.Length; Properties = properties; Input = new Layer(architecture[0], "Input"); Output = new Layer(architecture[l - 1], "Output"); Hidden = new Layer[l - 2]; for (int i = 1; i < l - 1; i++) { Hidden[i - 1] = new Layer(architecture[i]); } }