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

            if (cfg.Window == PredictorActivationLinWAvgSettings.NAWindowNum)
            {
                return(_continuousAvg.Result);
            }
            else
            {
                if (activationMDW.UsedCapacity >= cfg.Window)
                {
                    return(activationMDW.GetDataLinWeightedAvg(cfg.Window).Result);
                }
                else
                {
                    return(0d);
                }
            }
        }
예제 #2
0
        /// <inheritdoc/>
        public void Update(double activation, double normalizedActivation, bool spike)
        {
            PredictorActivationLinWAvgSettings cfg = (PredictorActivationLinWAvgSettings)Cfg;

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