Aim: Represents a typical histogram in statistics, which is a discrete estimate of the probability distribution of a continuous variable.
More...
#include <DGtal/math/Histogram.h>
template<typename TQuantity, typename TBinner = RegularBinner< TQuantity >>
class DGtal::Histogram< TQuantity, TBinner >
Aim: Represents a typical histogram in statistics, which is a discrete estimate of the probability distribution of a continuous variable.
Description of template class 'Histogram'
std::vector<double> v;
...
Statistic<double> stats;
stats.addValues( v.begin(), v.end() );
stats.terminate();
for (
unsigned int i = 0; i < hist.
size(); ++i )
std::cout << i <<
" " << hist.
pdf( i ) << std::endl;
Aim: Represents a typical histogram in statistics, which is a discrete estimate of the probability di...
void addValues(TInputIterator it, TInputIterator itE)
void init(Clone< Binner > binner)
- Template Parameters
-
TQuantity | any model of CEuclideanRing listed in NumberTraits and that can be castToDouble. |
TBinner | any model of CBinner that puts a quantity into a bin. Default is RegularBinner<TQuantity>. |
Definition at line 145 of file Histogram.h.
◆ Bin
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ Binner
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ ConstIterator
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ Container
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ Quantity
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ Self
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ Size
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ Formula
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Determines the number of bins k or the width h as a function of n (number of samples), s (variance of samples).
Enumerator |
---|
SquareRoot | Rule is k=sqrt(n)
|
Sturges | Rule is k=ceil(log_2(n)+1)
|
Rice | Rule is k=ceil(n^(1/3))
|
Scott | Rule is h=3.5s/(n^(1/3))
|
Definition at line 166 of file Histogram.h.
◆ ~Histogram()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ Histogram() [1/2]
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Constructor. The object is not valid.
◆ Histogram() [2/2]
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Copy constructor.
- Parameters
-
other | the object to clone. Forbidden by default. |
◆ accumulation()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
- Parameters
-
b | any bin in 0 .. size()-1 |
- Returns
- the total number of quantities in bins 0 to b (included).
- Precondition
- terminate() must be called before.
◆ addValue()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Add the quantity q to the histogram.
- Parameters
-
◆ addValues()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
template<typename TInputIterator >
void DGtal::Histogram< TQuantity, TBinner >::addValues |
( |
TInputIterator | it, |
|
|
TInputIterator | itE ) |
◆ area()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
- Returns
- the total number of samples in the histogram, i.e. the number of added quantities.
- Precondition
- terminate() must be called before.
◆ bin()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
- Parameters
-
- Returns
- the bin in which quantity q would fall if added to this object.
◆ BOOST_CONCEPT_ASSERT() [1/2]
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ BOOST_CONCEPT_ASSERT() [2/2]
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ BOOST_STATIC_ASSERT()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
DGtal::Histogram< TQuantity, TBinner >::BOOST_STATIC_ASSERT |
( |
(boost::is_same< TQuantity, typename TBinner::Quantity >::value) | | ) |
|
◆ cdf()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ clear()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
The object is fully cleared. The object must be initialized in order to be valid.
◆ init() [1/3]
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Initialization from a number of bins and a statistic (min, max, samples, variance can typically be used).
◆ init() [2/3]
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ init() [3/3]
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Initialization from a statistic (min, max, samples, variance can typically be used) and a given formula.
◆ isValid()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Checks the validity/consistency of the object.
- Returns
- 'true' if the object is valid, 'false' otherwise.
◆ nb()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
- Parameters
-
b | any bin in 0 .. size()-1 |
- Returns
- the number of quantities in bin b.
◆ operator=()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Assignment.
- Parameters
-
- Returns
- a reference on 'this'. Forbidden by default.
◆ pdf()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ prepare()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
Prepares container for further data.
◆ selfDisplay()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
void DGtal::Histogram< TQuantity, TBinner >::selfDisplay |
( |
std::ostream & | out | ) |
const |
Writes/Displays the object on an output stream.
- Parameters
-
out | the output stream where the object is written. |
◆ size()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ terminate()
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
◆ myBinner
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
The binner that places quantities into a bin.
Definition at line 285 of file Histogram.h.
◆ myCumulativeHistogram
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
The cumulative histogram data.
Definition at line 289 of file Histogram.h.
◆ myHistogram
template<typename TQuantity , typename TBinner = RegularBinner< TQuantity >>
The documentation for this class was generated from the following file: