Class TDigestAccumulator

java.lang.Object
org.djutils.stats.summarizers.quantileaccumulator.TDigestAccumulator
All Implemented Interfaces:
QuantileAccumulator

public class TDigestAccumulator
extends Object
implements QuantileAccumulator
TDigestAccumulator.java.

Copyright (c) 2020-2020 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
Author:
Alexander Verbraeck, Peter Knoppers
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int DEFAULT_COMPRESSION
    The compression used by the parameter-less constructor.
  • Constructor Summary

    Constructors 
    Constructor Description
    TDigestAccumulator()
    Construct a new TDigestAccumulator with compression set to DEFAULT_COMPRESSION.
    TDigestAccumulator​(int compression)
    Construct a new TDigestAccumulator.
  • Method Summary

    Modifier and Type Method Description
    double getQuantile​(Tally tally, double probability)
    Compute (or approximate) the value that corresponds to the given fraction (percentile).
    double ingest​(double value)
    Ingest one value with weight 1.
    void initialize()
    Reset (clear all accumulated information).
    String toString()

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • TDigestAccumulator

      public TDigestAccumulator​(int compression)
      Construct a new TDigestAccumulator.
      Parameters:
      compression - int; the number of bins to compress the data into
    • TDigestAccumulator

      public TDigestAccumulator()
      Construct a new TDigestAccumulator with compression set to DEFAULT_COMPRESSION.
  • Method Details

    • ingest

      public double ingest​(double value)
      Ingest one value with weight 1. Should be called only from the Tally object and AFTER processing the value in the tally.
      Specified by:
      ingest in interface QuantileAccumulator
      Parameters:
      value - double; the value
      Returns:
      double; the ingested value
    • getQuantile

      public double getQuantile​(Tally tally, double probability)
      Compute (or approximate) the value that corresponds to the given fraction (percentile).
      Specified by:
      getQuantile in interface QuantileAccumulator
      Parameters:
      tally - Tally; the tally object that accumulates mean, minimum, maximum, count, etc.
      probability - double; value between 0.0 and 1.0 (both inclusive)
      Returns:
      double; the computed or approximated quantile value
    • initialize

      public void initialize()
      Reset (clear all accumulated information).
      Specified by:
      initialize in interface QuantileAccumulator
    • toString

      public final String toString()
      Overrides:
      toString in class Object