MongoDB  2.7.0
Public Member Functions | Static Public Attributes | List of all members
mongo::DistributionEstimators< NumQuantiles > Class Template Reference

Computes 'NumQuantiles' quantiles. More...

#include <descriptive_stats.h>

Inheritance diagram for mongo::DistributionEstimators< NumQuantiles >:
mongo::SummaryEstimators< Sample, NumQuantiles >

Public Member Functions

DistributionEstimatorsoperator<< (const double sample)
 
double quantile (std::size_t i) const
 Updates the estimators with another observed value.
 
bool quantilesReady () const
 
double min () const
 
double max () const
 
double median () const
 
double probability (std::size_t i) const
 
double icdf (double prob) const
 
void appendQuantilesToBSONArrayBuilder (BSONArrayBuilder &arr) const
 Appends the quantiles to the provided BSONArrayBuilder. More...
 

Static Public Attributes

static const size_t numberOfQuantiles = NumQuantiles
 Number of computed quantiles, excluding minimum and maximum.
 

Detailed Description

template<std::size_t NumQuantiles>
class mongo::DistributionEstimators< NumQuantiles >

Computes 'NumQuantiles' quantiles.

The quantiles at probability 0 and 1 (minimum and maximum observations) are always computed. Thus DistributionEstimators<3> computes the the 1st, 2nd and 3rd quartiles (probabilities .25, .50, .75) and the default 0th and 5th (min and max).

The quantile estimators are mean square consistent (they become a better approximation of the actual quantiles as the sample size grows).

Member Function Documentation

template<std::size_t NumQuantiles>
void mongo::DistributionEstimators< NumQuantiles >::appendQuantilesToBSONArrayBuilder ( BSONArrayBuilder arr) const

Appends the quantiles to the provided BSONArrayBuilder.

REQUIRES e.quantilesReady() == true

template<std::size_t NumQuantiles>
double mongo::DistributionEstimators< NumQuantiles >::icdf ( double  prob) const
inline
Returns
value for the nearest available quantile for probability 'prob'
template<std::size_t NumQuantiles>
double mongo::DistributionEstimators< NumQuantiles >::max ( ) const
inline
Returns
estimated maximum

NOTE: use SimpleEstimators::max for an exact value.

template<std::size_t NumQuantiles>
double mongo::DistributionEstimators< NumQuantiles >::median ( ) const
inline
Returns
estimated median (2nd quartile)
template<std::size_t NumQuantiles>
double mongo::DistributionEstimators< NumQuantiles >::min ( ) const
inline
Returns
estimated minimum

NOTE: use SimpleEstimators::min for an exact value.

template<std::size_t NumQuantiles>
double mongo::DistributionEstimators< NumQuantiles >::probability ( std::size_t  i) const
inline
Returns
probability associated with the i-th quantile
template<std::size_t NumQuantiles>
bool mongo::DistributionEstimators< NumQuantiles >::quantilesReady ( ) const
inline
Returns
true when enough value has been observed to output sensible quantiles

The documentation for this class was generated from the following files: