public RecurrentNetwork(int inputNeuronsCount, int outputNeuronsCount, int hiddenLayersCount, int hiddenNeuronsCount) { //Initizating input layer _inputLayer = new Layer(inputNeuronsCount, new LinearFunction(), null, null); Layers.Add(_inputLayer); //Initizating hidden layers var hiddenLayers = new List<Layer>(); for (var i = 0; i < hiddenLayersCount; i++) { var hiddenLayer = new Layer(hiddenNeuronsCount, new SigmoidFunction(), Layers.Last(), null); Layers.Last().SetOutputLayer(hiddenLayer); hiddenLayers.Add(hiddenLayer); } Layers.AddRange(hiddenLayers); //Initizating output layer _outputLayer = new Layer(outputNeuronsCount, new SigmoidFunction(), Layers.Last(), null); Layers.Last().SetOutputLayer(_outputLayer); Layers.Add(_outputLayer); //Initizating recurrent layer _recurrentLayer = new Layer(0, new LinearFunction(), null, hiddenLayers[0]); hiddenLayers[0].SetRecurrentLayer(_recurrentLayer); Layers.Add(_recurrentLayer); }
public Layer(int neuronCount, IActivationFunction activationFunction, Layer inputLayer, Layer outputLayer, Layer recurrentLayer = null) { NeuronCount = neuronCount; InputLayer = inputLayer; OutputLayer = outputLayer; RecurrentLayer = recurrentLayer; ActivationFunction = activationFunction; UpdateMarkers(); for (var i = 0; i < NeuronCount; i++) Neurons.Add(new Neuron(this)); }
public void SetRecurrentLayer(Layer recurrentLayer) { RecurrentLayer = recurrentLayer; RecurrentLayer.UpdateMarkers(); }
public void SetOutputLayer(Layer outputLayer) { OutputLayer = outputLayer; UpdateMarkers(); }
public void SetInputLayer(Layer inputLayer) { InputLayer = inputLayer; UpdateMarkers(); }
public Neuron(Layer parent) { _parent = parent; }