Example #1
0
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name = "neuronsCount">Number of neurons in the layer</param>
 /// <param name = "inputsCount">Number of inputs per each neuron in the layer</param>
 /// <param name = "function">Activation function for the whole layer</param>
 public Layer(int neuronsCount, int inputsCount, IActivationFunction function)
 {
     _inputsCount = Math.Max(1, inputsCount);
     _neuronsCount = Math.Max(1, neuronsCount);
     _function = function;
     _neurons = new Neuron[_neuronsCount];
     for (int i = 0; i < neuronsCount; i++)
         _neurons[i] = new Neuron(inputsCount, function);
 }
Example #2
0
 /// <summary>
 ///   Constructor, all nonspecified parameters are like in default constructor
 /// </summary>
 /// <param name = "neuronsCount">Number of neurons in the layer</param>
 /// <param name = "inputsCount">Number of inputs per each neuron in the layer</param>
 public Layer(int neuronsCount, int inputsCount)
 {
     _inputsCount = Math.Max(1, inputsCount);
     _neuronsCount = Math.Max(1, neuronsCount);
     // create collection of neurons
     _neurons = new Neuron[_neuronsCount];
     _function = new SigmoidFunction();
     for (int i = 0; i < neuronsCount; i++)
         _neurons[i] = new Neuron(inputsCount);
 }