Beispiel #1
0
        /// <inheritdoc/>
        public double Compute(BasicStat continuousActivationStat,
                              BasicStat continuousActivationDiffStat,
                              MovingDataWindow activationMDW,
                              SimpleQueue <byte> firingMDW,
                              double activation,
                              double normalizedActivation,
                              bool spike
                              )
        {
            PredictorFiringTraceSettings cfg = (PredictorFiringTraceSettings)Cfg;

            if (cfg.Window == PredictorFiringTraceSettings.NAWindowNum)
            {
                return(_continuousTrace);
            }
            else
            {
                if (firingMDW.Count >= cfg.Window)
                {
                    double trace = 0d;
                    for (int i = cfg.Window - 1; i >= 0; i--)
                    {
                        trace *= (1d - cfg.Fading);
                        trace += firingMDW.GetElementAt(i, true);
                    }
                    return(trace);
                }
                else
                {
                    return(0d);
                }
            }
        }
Beispiel #2
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="cfg">The configuration of the predictor.</param>
 public PredictorFiringTrace(PredictorFiringTraceSettings cfg)
 {
     Cfg = cfg;
     if (cfg.Window == PredictorFiringTraceSettings.NAWindowNum)
     {
         Reset();
     }
     return;
 }
Beispiel #3
0
        /// <inheritdoc/>
        public void Update(double activation, double normalizedActivation, bool spike)
        {
            PredictorFiringTraceSettings cfg = (PredictorFiringTraceSettings)Cfg;

            if (cfg.Window == PredictorFiringTraceSettings.NAWindowNum)
            {
                _continuousTrace *= (1d - cfg.Fading);
                _continuousTrace += spike ? 1d : 0d;
            }
            return;
        }
Beispiel #4
0
 /// <summary>
 /// The copy constructor.
 /// </summary>
 /// <param name="source">The source instance.</param>
 public PredictorFiringTraceSettings(PredictorFiringTraceSettings source)
     : this(source.Fading, source.Window)
 {
     return;
 }