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

            if (cfg.Window == PredictorActivationDiffStatFigureSettings.NAWindowNum)
            {
                return(continuousActivationDiffStat.Get(cfg.Figure));
            }
            else
            {
                if (activationMDW.UsedCapacity >= cfg.Window)
                {
                    return(activationMDW.GetDataDiffStat(cfg.Window).Get(cfg.Figure));
                }
                else
                {
                    return(0d);
                }
            }
        }
コード例 #2
0
        /// <inheritdoc />
        public double Transform(double[] data)
        {
            if (double.IsNaN(data[_fieldIdx]))
            {
                throw new InvalidOperationException($"Invalid data value at input field index {_fieldIdx} (NaN).");
            }
            _lastValues.Enqueue(data[_fieldIdx], true);
            BasicStat stat = new BasicStat();

            for (int i = 0; i < _lastValues.Count; i++)
            {
                stat.AddSample(_lastValues.GetElementAt(i, true));
            }
            return(stat.Get(_cfg.OutputFigure));
        }