Пример #1
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="inputEntryPoint">Input entry point coordinates within the reservoir.</param>
 /// <param name="inputFieldIdx">Index of the corresponding reservoir's input field.</param>
 /// <param name="inputRange">
 /// Range of input value.
 /// It is very recommended to have input values normalized and standardized before
 /// they are passed as an input.
 /// </param>
 public InputNeuron(int[] inputEntryPoint, int inputFieldIdx, Interval inputRange)
 {
     Placement   = new NeuronPlacement(-1, inputFieldIdx, -1, inputFieldIdx, 0, inputEntryPoint[0], inputEntryPoint[1], inputEntryPoint[2]);
     OutputRange = inputRange.DeepClone();
     Statistics  = new NeuronStatistics(OutputRange);
     Reset(false);
     return;
 }
Пример #2
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="placement">Home pool identificator and neuron placement within the pool.</param>
 /// <param name="role">Neuron's signal role (Excitatory/Inhibitory).</param>
 /// <param name="activation">Instantiated activation function.</param>
 /// <param name="bias">Constant bias.</param>
 public SpikingNeuron(NeuronPlacement placement,
                      CommonEnums.NeuronRole role,
                      IActivationFunction activation,
                      double bias
                      )
 {
     Placement = placement;
     Role      = role;
     Bias      = bias;
     //Check whether function is spiking
     if (activation.OutputSignalType != CommonEnums.NeuronSignalType.Spike)
     {
         throw new ArgumentException("Activation function is not spiking.", "activation");
     }
     _activation = activation;
     _firingRate = new FiringRate();
     Statistics  = new NeuronStatistics(_activation.InternalStateRange);
     Reset(false);
     return;
 }
Пример #3
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="placement">Home pool identificator and neuron placement within the pool.</param>
 /// <param name="role">Neuron's signal role (Excitatory/Inhibitory).</param>
 /// <param name="activation">Instantiated activation function.</param>
 /// <param name="bias">Constant bias.</param>
 /// <param name="retainmentRatio">Retainment ratio.</param>
 public AnalogNeuron(NeuronPlacement placement,
                     CommonEnums.NeuronRole role,
                     IActivationFunction activation,
                     double bias,
                     double retainmentRatio
                     )
 {
     Placement = placement;
     Role      = role;
     Bias      = bias;
     //Check whether function is analog
     if (activation.OutputSignalType != CommonEnums.NeuronSignalType.Analog)
     {
         throw new ArgumentException("Activation function is not analog.", "activation");
     }
     _activation      = activation;
     _retainmentRatio = retainmentRatio;
     Statistics       = new NeuronStatistics(OutputRange);
     Reset(false);
     return;
 }
Пример #4
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="placement">Home pool identificator and neuron placement within the pool.</param>
 /// <param name="role">Neuron's role (Excitatory/Inhibitory).</param>
 /// <param name="activation">Instantiated activation function.</param>
 /// <param name="signalingRestriction">Output signaling restriction. Spiking activation causes output signal always restricted to SpikingOnly.</param>
 /// <param name="predictorsCfg">Enabled/Disabled predictors for the neuron.</param>
 /// <param name="bias">Constant bias to be applied.</param>
 /// <param name="analogFiringThreshold">A number between 0 and 1 (LT1). Every time the new activation value is higher than the previous activation value by at least the threshold, it is evaluated as a firing event. Ignored in case of spiking activation.</param>
 /// <param name="retainmentStrength">Strength of the analog neuron's retainment property. Ignored in case of spiking activation.</param>
 public HiddenNeuron(NeuronPlacement placement,
                     NeuronCommon.NeuronRole role,
                     IActivationFunction activation,
                     NeuronCommon.NeuronSignalingRestrictionType signalingRestriction,
                     HiddenNeuronPredictorsSettings predictorsCfg,
                     double bias = 0,
                     double analogFiringThreshold = PoolSettings.NeuronGroupSettings.DefaultAnalogFiringThreshold,
                     double retainmentStrength    = 0
                     )
 {
     Placement  = placement;
     Statistics = new NeuronStatistics();
     if (role == NeuronCommon.NeuronRole.Input)
     {
         throw new ArgumentException("Role of the hidden neuron can not be Input.", "role");
     }
     Role          = role;
     Bias          = bias;
     PredictorsCfg = predictorsCfg;
     //Activation specific
     _activation = activation;
     if (activation.TypeOfActivation == ActivationType.Spiking)
     {
         //Spiking
         SignalingRestriction   = NeuronCommon.NeuronSignalingRestrictionType.SpikingOnly;
         _analogFiringThreshold = 0;
         _retainmentStrength    = 0;
     }
     else
     {
         //Analog
         SignalingRestriction   = signalingRestriction;
         _analogFiringThreshold = analogFiringThreshold;
         _retainmentStrength    = retainmentStrength;
     }
     _predictors = predictorsCfg != null ? new HiddenNeuronPredictors(predictorsCfg) : null;
     Reset(false);
     return;
 }