Package smile.sort

Class IQAgent

java.lang.Object
smile.sort.IQAgent

public class IQAgent extends Object
Incremental quantile estimation. This class provide a robust and extremely fast algorithm to estimate arbitrary quantile values from a continuing stream of data values. Basically, the data values fly by in a stream. We look at each value only once and do a constant-time process on it. From time to time, we can use this class to report any arbitrary p-quantile value of the data that we have seen thus far.

References

  1. John M. Chambers, David A. James, Diane Lambert and Scott Vander Wiel. Monitoring Networked Applications With Incremental Quantile Estimation. Statistical Sciencec21(4):463–475, 2006.
  • Constructor Details

    • IQAgent

      public IQAgent()
      Constructor. The batch size is set to 1000.
    • IQAgent

      public IQAgent(int nbuf)
      Constructor.
      Parameters:
      nbuf - batch size. You may use 10000 if you expected > 1,000,000 data values. Otherwise, 1000 should be fine.
  • Method Details

    • add

      public void add(double datum)
      Assimilate a new value from the stream.
      Parameters:
      datum - a new value.
    • quantile

      public double quantile(double p)
      Returns the estimated p-quantile for the data seen so far. For example, p = 0.5 for median.
      Parameters:
      p - the percentile.
      Returns:
      the quantile.