Exemplo n.º 1
0
        /// <inheritdoc/>
        public double Compute(BasicStat continuousActivationStat,
                              BasicStat continuousActivationDiffStat,
                              MovingDataWindow activationMDW,
                              SimpleQueue <byte> firingMDW,
                              double activation,
                              double normalizedActivation,
                              bool spike
                              )
        {
            PredictorActivationDiffLinWAvgSettings cfg = (PredictorActivationDiffLinWAvgSettings)Cfg;

            if (cfg.Window == PredictorActivationDiffLinWAvgSettings.NAWindowNum)
            {
                return(_continuousAvg.Result);
            }
            else
            {
                if (activationMDW.UsedCapacity >= cfg.Window)
                {
                    return(activationMDW.GetDataDiffLinWeightedAvg(cfg.Window).Result);
                }
                else
                {
                    return(0d);
                }
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public void Update(double activation, double normalizedActivation, bool spike)
        {
            PredictorActivationDiffLinWAvgSettings cfg = (PredictorActivationDiffLinWAvgSettings)Cfg;

            if (cfg.Window == PredictorActivationDiffLinWAvgSettings.NAWindowNum)
            {
                ++_continuousWeight;
                _continuousAvg.AddSample(activation, _continuousWeight);
            }
            return;
        }
Exemplo n.º 3
0
 //Constructor
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="cfg">The configuration of the predictor.</param>
 public PredictorActivationDiffLinWAvg(PredictorActivationDiffLinWAvgSettings cfg)
 {
     Cfg = cfg;
     if (cfg.Window == PredictorActivationDiffLinWAvgSettings.NAWindowNum)
     {
         _continuousAvg = new WeightedAvg();
         Reset();
     }
     else
     {
         _continuousAvg = null;
     }
     return;
 }
 /// <summary>
 /// The copy constructor.
 /// </summary>
 /// <param name="source">The source instance.</param>
 public PredictorActivationDiffLinWAvgSettings(PredictorActivationDiffLinWAvgSettings source)
     : this(source.Window)
 {
     return;
 }