public NeuralNetwork(int inputLayerNeuronsCount, int hiddenLayerNeuronsCount, int outputLayerNeuronsCount) { //System.Diagnostics.Debugger.Break(); neuronLayers[0] = new NeuronLayer(inputLayerNeuronsCount); neuronLayers[1] = new NeuronLayer(hiddenLayerNeuronsCount, InputLayer); neuronLayers[2] = new NeuronLayer(outputLayerNeuronsCount, HiddenLayer); NeuronLayers = Array.AsReadOnly(neuronLayers); }
public NeuronLayer(int size, NeuronLayer activatorsLayer = null) { Neurons = new Neuron[size]; Bias = new Bias(); var random = new Random(); for (int i = 0; i < size; i++) { var neuron = new Neuron(); if (activatorsLayer != null) { foreach (var activator in activatorsLayer.Neurons) { neuron.AddActivator(activator, random.NextNormalizedDouble()); } neuron.AddActivator(activatorsLayer.Bias, random.NextNormalizedDouble()); } Neurons[i] = neuron; } }