/// <summary> /// /// </summary> /// <param name="input"></param> /// <param name="hiddenLayerAmount"></param> /// <param name="outLayerAmount"></param> /// <param name="learningRate"></param> public MultiLayerPerceptronNetwork(double[] input, int hiddenLayerAmount, int outLayerAmount, double learningRate) { Input = input; LearningRate = learningRate; // Allocating Hidden Layer HiddenLayer = new Neuron[ hiddenLayerAmount ]; // Instantiating Neurons from Hidden Layer for (int i = 0; i < HiddenLayer.Length; i++) HiddenLayer[i] = new Neuron(Input.Length, LearningRate); // // Allocating Output Layer OutLayer = new Neuron[ outLayerAmount ]; // Instantiating Neurons from Output Layer for (int i = 0; i < OutLayer.Length; i++) OutLayer[i] = new Neuron(HiddenLayer.Length, LearningRate); // // Setting Weights SortWeights(); //SetManuallyWeights(); // Set input on the hidden layer SetInputOnHiddenLayer(); }
// ------------------- 2.CONSTRUCTORS ------------------- /// <summary> /// /// </summary> /// <param name="hiddenLayerAmount">Quantidade de neurônios na camada oculta</param> /// <param name="outLayerAmount">Quantidade de neurônios na camada de saída</param> /// <param name="learningRate">Taxa de aprendizado</param> public MultiLayerPerceptronNetwork(int inputAmount, int hiddenLayerAmount, int outLayerAmount, double learningRate) { LearningRate = learningRate; // Allocating Input Layer Input = new double[inputAmount]; // Allocating Hidden Layer HiddenLayer = new Neuron[hiddenLayerAmount]; // Instantiating Neurons from Hidden Layer for (int i = 0; i < HiddenLayer.Length; i++) HiddenLayer[i] = new Neuron(Input.Length, LearningRate); // // Allocating Output Layer OutLayer = new Neuron[outLayerAmount]; // Instantiating Neurons from Output Layer for (int i = 0; i < OutLayer.Length; i++) OutLayer[i] = new Neuron(HiddenLayer.Length, LearningRate); // // Setting Weights SortWeights(); }