Example #1
0
        /// <summary>
        /// Returns statistics of data samples currently stored in the internal sliding window
        /// </summary>
        /// <param name="latestFirst">Specifies logical order (latest..oldest or oldest..latest)</param>
        /// <param name="reqNumOfSamples">Number of requiered samples</param>
        public BasicStat GetDataStat(bool latestFirst = false, int reqNumOfSamples = -1)
        {
            int       numOfSamplesToBeProcessed = reqNumOfSamples == -1 ? _dataWindow.Count : reqNumOfSamples;
            BasicStat stat = new BasicStat();

            for (int i = 0; i < numOfSamplesToBeProcessed; i++)
            {
                stat.AddSampleValue(_dataWindow.GetElementAt(i, latestFirst));
            }
            return(stat);
        }
Example #2
0
        /// <summary>
        /// Computes error statistics of Y values (computedY - sampleY)
        /// </summary>
        public BasicStat ComputeRegressionErrStat()
        {
            ComputeRegression();
            BasicStat errStat = new BasicStat();

            if (_pointCollection.Count > 0)
            {
                foreach (Point2D point in _pointCollection)
                {
                    double regrY = _a * point._x + _b;
                    errStat.AddSampleValue(Math.Abs(regrY - point._y));
                }
            }
            return(errStat);
        }
Example #3
0
 /// <summary>
 /// Adapts to the sample value
 /// </summary>
 /// <param name="sampleValue">Sample value</param>
 public void Adjust(double sampleValue)
 {
     _samplesStat.AddSampleValue(sampleValue);
     return;
 }