Ejemplo n.º 1
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="location">The neuron's location.</param>
 /// <param name="analogActivation">The instance of an analog activation function.</param>
 /// <param name="bias">The constant bias.</param>
 /// <param name="firingThreshold">The firing threshold value. It must be GE0 and LT1. Every time the current normalized activation is higher than the normalized past reference activation by at least this threshold, it is evaluated as a firing event.</param>
 /// <param name="firingThresholdMaxRefDeepness">Maximum age of the past activation for the evaluation of the firing event.</param>
 /// <param name="retainmentStrength">The strength of the analog neuron's retainment property. It enables the leaky integrator feature of the neuron.</param>
 /// <param name="predictorsProviderCfg">The configuration of the predictors provider.</param>
 public HiddenNeuron(NeuronLocation location,
                     AFAnalogBase analogActivation,
                     double bias,
                     double firingThreshold,
                     int firingThresholdMaxRefDeepness,
                     double retainmentStrength,
                     PredictorsProviderSettings predictorsProviderCfg
                     )
 {
     Location   = location;
     Statistics = new NeuronStatistics();
     Bias       = bias;
     //Activation check
     if (analogActivation.TypeOfActivation == ActivationType.Spiking)
     {
         throw new ArgumentException($"Wrong type of the activation function.", "analogActivation");
     }
     _activationFn             = analogActivation;
     _analogFiringThreshold    = firingThreshold;
     _histActivationsQueue     = firingThresholdMaxRefDeepness < 2 ? null : new SimpleQueue <double>(firingThresholdMaxRefDeepness);
     _analogRetainmentStrength = retainmentStrength;
     _predictorsProvider       = predictorsProviderCfg != null ? new PredictorsProvider(predictorsProviderCfg) : null;
     OutputData = new NeuronOutputData();
     Reset(false);
     return;
 }
Ejemplo n.º 2
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance of hidden neuron having analog activation
 /// </summary>
 /// <param name="location">Information about a neuron location within the neural preprocessor</param>
 /// <param name="analogActivation">Instantiated activation function.</param>
 /// <param name="bias">Constant bias to be applied.</param>
 /// <param name="firingThreshold">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.</param>
 /// <param name="thresholdMaxRefDeepness">Maximum deepness of historical normalized activation value to be compared with current normalized activation value when evaluating firing event.</param>
 /// <param name="retainmentStrength">Strength of the analog neuron's retainment property.</param>
 /// <param name="predictorsCfg">Configuration of neuron's predictors</param>
 public HiddenNeuron(NeuronLocation location,
                     IActivationFunction analogActivation,
                     double bias,
                     double firingThreshold,
                     int thresholdMaxRefDeepness,
                     double retainmentStrength,
                     PredictorsSettings predictorsCfg
                     )
 {
     Location   = location;
     Statistics = new NeuronStatistics();
     Bias       = bias;
     //Activation check
     if (analogActivation.TypeOfActivation == ActivationType.Spiking)
     {
         throw new InvalidOperationException($"Called wrong type of hidden neuron constructor for analog activation.");
     }
     _activation               = analogActivation;
     _analogFiringThreshold    = firingThreshold;
     _histActivationsQueue     = thresholdMaxRefDeepness < 2 ? null : new SimpleQueue <double>(thresholdMaxRefDeepness);
     _analogRetainmentStrength = retainmentStrength;
     _predictors               = predictorsCfg != null ? new PredictorsProvider(predictorsCfg) : null;
     OutputData = new NeuronOutputData();
     Reset(false);
     return;
 }
Ejemplo n.º 3
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="location">Neuron's location</param>
 public AnalogInputNeuron(NeuronLocation location)
 {
     Location   = location;
     Statistics = new NeuronStatistics();
     OutputData = new NeuronOutputData();
     Reset(false);
     return;
 }
Ejemplo n.º 4
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="location">The neuron's location.</param>
 /// <param name="verticalCycles">The number of the neuron's vertical cycles.</param>
 public AnalogInputNeuron(NeuronLocation location, int verticalCycles = 1)
 {
     Location        = location;
     _verticalCycles = verticalCycles;
     Statistics      = new NeuronStatistics();
     OutputData      = new NeuronOutputData();
     Reset(false);
     return;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="source">Source instance.</param>
 public NeuronLocation(NeuronLocation source)
     : this(source.ReservoirID,
            source.ReservoirFlatIdx,
            source.PoolID,
            source.PoolFlatIdx,
            source.PoolGroupID,
            source.ReservoirCoordinates[0],
            source.ReservoirCoordinates[1],
            source.ReservoirCoordinates[2])
 {
     return;
 }
Ejemplo n.º 6
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="location">The neuron's location.</param>
 /// <param name="spikingActivation">The instance of a spiking activation function.</param>
 /// <param name="bias">The constant bias.</param>
 /// <param name="predictorsProviderCfg">The configuration of the predictors provider.</param>
 public HiddenNeuron(NeuronLocation location,
                     AFSpikingBase spikingActivation,
                     double bias,
                     PredictorsProviderSettings predictorsProviderCfg
                     )
 {
     Location   = location;
     Statistics = new NeuronStatistics();
     Bias       = bias;
     //Activation check
     if (spikingActivation.TypeOfActivation == ActivationType.Analog)
     {
         //Spiking
         throw new ArgumentException($"Wrong type of the activation function.", "spikingActivation");
     }
     _activationFn             = spikingActivation;
     _analogFiringThreshold    = 0;
     _histActivationsQueue     = null;
     _analogRetainmentStrength = 0;
     _predictorsProvider       = predictorsProviderCfg != null ? new PredictorsProvider(predictorsProviderCfg) : null;
     OutputData = new NeuronOutputData();
     Reset(false);
     return;
 }
Ejemplo n.º 7
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance of hidden neuron having spiking activation
 /// </summary>
 /// <param name="location">Information about a neuron location within the neural preprocessor</param>
 /// <param name="spikingActivation">Instantiated activation function.</param>
 /// <param name="bias">Constant bias to be applied.</param>
 /// <param name="predictorsCfg">Configuration of neuron's predictors</param>
 public HiddenNeuron(NeuronLocation location,
                     IActivationFunction spikingActivation,
                     double bias,
                     PredictorsSettings predictorsCfg
                     )
 {
     Location   = location;
     Statistics = new NeuronStatistics();
     Bias       = bias;
     //Activation check
     if (spikingActivation.TypeOfActivation == ActivationType.Analog)
     {
         //Spiking
         throw new InvalidOperationException($"Called wrong type of hidden neuron constructor for spiking activation.");
     }
     _activation               = spikingActivation;
     _analogFiringThreshold    = 0;
     _histActivationsQueue     = null;
     _analogRetainmentStrength = 0;
     _predictors               = predictorsCfg != null ? new PredictorsProvider(predictorsCfg) : null;
     OutputData = new NeuronOutputData();
     Reset(false);
     return;
 }