Belle II Software development
|
A container for collecting data, where min- and max-quantiles near q(0) and q(1) are to be found. More...
#include <MinMaxCollector.h>
Public Member Functions | |
BELLE2_DEFINE_EXCEPTION (Quantile_out_of_bounds, "The quantileCut (%1%) you gave is illegal (only allowed between 0-1)") | |
returns true, if the valueContainers were increased in size. | |
BELLE2_DEFINE_EXCEPTION (Illegal_quantile, "The quantiles you asked for (%1% and %2%) are not within the collected range of data (0-%3% and %4%-1) to prevent this happening, you have to pass a bigger value for QuantileCut when constructing a MinMaxCollector-Instance!") | |
exception shall be thrown if the requested quantiles are not within the ranges collected | |
BELLE2_DEFINE_EXCEPTION (Request_in_empty_Container, "Data of an empty container was requested!") | |
exception shall be thrown if value is not between 0-1 and therefore not normalized | |
MinMaxCollector (DataType quantileCut=0.025, unsigned warmUpThreshold=10) | |
constructor. | |
std::pair< DataType, DataType > | getMinMax (DataType minQuantile=0., DataType maxQuantile=1.) const |
for given pair of quantiles, the according cuts (min, max) will be returned. | |
void | insert (DataType newVal) |
for convenience reasons, pipe to append. | |
void | push_back (DataType newVal) |
for convenience reasons, pipe to append. | |
void | append (DataType newVal) |
append new value | |
void | merge (const MinMaxCollector< DataType > &other) |
fill the stuff of the other one with this one | |
unsigned | totalSize () const |
returns the combined size of the containers storing the values | |
unsigned | size () const |
returns the size (in a sense of roughly collected data) | |
bool | empty () const |
returns if internal containers are empty | |
void | clear () |
deletes all values collected so far and resets to constructor-settings. | |
unsigned | sampleSize () const |
returns actual sampleSize | |
void | print (bool printFull=false) const |
print an overview of the entries collected. | |
std::string | getName (bool printFull=false) const |
return a string of an overview of the entries collected. | |
Protected Member Functions | |
bool | addMin (DataType newVal, bool allow2Grow) |
add entry to minContainer if it fits in | |
bool | addMax (DataType newVal, bool allow2Grow) |
add entry to maxContainer if it fits in | |
bool | addEntry (DataType newVal, bool isMinContainer, bool allow2Grow) |
add entry to container if it fits in | |
void | sortIn (DataType newVal, bool isMinContainer) |
add newVal to appropriate container | |
unsigned | getIndex (DataType aQuantile) const |
the correct access-index for given quantile will be determined | |
bool | checkVectorSize (const std::deque< DataType > &container) |
returns true, if vector is allowed to grow | |
Protected Attributes | |
std::deque< DataType > | m_smallestValues |
collects smallest values occurred so far | |
std::deque< DataType > | m_biggestValues |
collects biggest values occurred so far | |
unsigned | m_sampleSize |
counts number of values added so far | |
DataType | m_quantileCut |
sets the threshold for storing data. | |
unsigned | m_warmUpThreshold |
sets a threshold for warm-up. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const MinMaxCollector &mmCol) |
overloaded '<<' stream operator. | |
A container for collecting data, where min- and max-quantiles near q(0) and q(1) are to be found.
can only approximately find actual quantiles and is sensitive to sorted data . -> random samples have to be used! Always exact for min and max, but the nearer the requested quantiles to the given quantileCut, the more sensitive it is to sorted data. For random input, the quantiles always stay very near to the real ones (if they are not the correct ones already). Prerequisites for DataType:
Definition at line 42 of file MinMaxCollector.h.
|
inline |
constructor.
quantileCut determines the fraction of the sample to be stored (0-1). warmUpThreshold pays some overhead for sample sizes to get more accuracy (for bigger sample sizes the overhead and the advantage of warmUp vanish (since then the results converge to the real ones anyway).
Definition at line 166 of file MinMaxCollector.h.
|
inlineprotected |
add entry to container if it fits in
Definition at line 74 of file MinMaxCollector.h.
|
inlineprotected |
add entry to maxContainer if it fits in
Definition at line 69 of file MinMaxCollector.h.
|
inlineprotected |
|
inline |
append new value
Definition at line 217 of file MinMaxCollector.h.
BELLE2_DEFINE_EXCEPTION | ( | Quantile_out_of_bounds | , |
"The quantileCut (%1%) you gave is illegal (only allowed between 0-1)" | |||
) |
returns true, if the valueContainers were increased in size.
exception shall be thrown if value is not between 0-1 and therefore not normalized
|
inlineprotected |
returns true, if vector is allowed to grow
Definition at line 123 of file MinMaxCollector.h.
|
inline |
deletes all values collected so far and resets to constructor-settings.
Definition at line 271 of file MinMaxCollector.h.
|
inline |
|
inlineprotected |
the correct access-index for given quantile will be determined
Definition at line 116 of file MinMaxCollector.h.
|
inline |
for given pair of quantiles, the according cuts (min, max) will be returned.
Definition at line 182 of file MinMaxCollector.h.
|
inline |
return a string of an overview of the entries collected.
if parameter given is 'true' full print will be done, if false, the values will be sketched with means.
Definition at line 290 of file MinMaxCollector.h.
|
inline |
for convenience reasons, pipe to append.
Definition at line 205 of file MinMaxCollector.h.
|
inline |
fill the stuff of the other one with this one
Definition at line 236 of file MinMaxCollector.h.
|
inline |
print an overview of the entries collected.
if parameter given is 'true' full print will be done, if false, the values will be sketched with means.
Definition at line 284 of file MinMaxCollector.h.
|
inline |
for convenience reasons, pipe to append.
Definition at line 211 of file MinMaxCollector.h.
|
inline |
|
inline |
returns the size (in a sense of roughly collected data)
Definition at line 260 of file MinMaxCollector.h.
|
inlineprotected |
add newVal to appropriate container
TODO
replace deque with vector and implement individual sort functions for smallest- and biggestValues.
Definition at line 97 of file MinMaxCollector.h.
|
inline |
returns the combined size of the containers storing the values
Definition at line 254 of file MinMaxCollector.h.
|
friend |
overloaded '<<' stream operator.
Print secID to stream by converting it to string
Definition at line 177 of file MinMaxCollector.h.
|
protected |
collects biggest values occurred so far
Definition at line 48 of file MinMaxCollector.h.
|
protected |
sets the threshold for storing data.
min- and max-container will store the smallest/biggest quantileCut*100 (== %) of the total sample.
Definition at line 55 of file MinMaxCollector.h.
|
protected |
counts number of values added so far
Definition at line 51 of file MinMaxCollector.h.
|
protected |
collects smallest values occurred so far
Definition at line 45 of file MinMaxCollector.h.
|
protected |
sets a threshold for warm-up.
The higher the value, the more accurate the quantiles will be, but the more overhead for small sample sizes will be too.
Definition at line 59 of file MinMaxCollector.h.