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);
        }
Example #2
0
        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));
        }
Example #3
0
 public void SetRecurrentLayer(Layer recurrentLayer)
 {
     RecurrentLayer = recurrentLayer;
     RecurrentLayer.UpdateMarkers();
 }
Example #4
0
 public void SetOutputLayer(Layer outputLayer)
 {
     OutputLayer = outputLayer;
     UpdateMarkers();
 }
Example #5
0
 public void SetInputLayer(Layer inputLayer)
 {
     InputLayer = inputLayer;
     UpdateMarkers();
 }
Example #6
0
 public Neuron(Layer parent)
 {
     _parent = parent;
 }