![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Represent the chi2 distribution. More...
#include <agrum/tools/core/math/chi2.h>
Public Member Functions | |
Constructors / Destructors | |
Chi2 (const std::vector< std::size_t > &var_modalities, double confidence_proba=GUM_LEARNING_CONFIDENCE_PROBA) | |
Default constructor. More... | |
~Chi2 () | |
Class destructor. More... | |
Accessors / Modifiers | |
void | setConditioningNodes (const std::vector< Idx > &db_conditioning_ids) |
Sets the conditioning nodes (useful for computing degrees of freedom). More... | |
double | criticalValue (const std::pair< Idx, Idx > &pair) |
Computes the critical value according to the number of degrees of freedom. More... | |
double | criticalValue (Idx var1, Idx var2) |
Computes the critical value according to the number of degrees of freedom. More... | |
Size | degreesOfFreedom (const std::pair< Idx, Idx > &pair) |
Returns the number of degrees of freedom. More... | |
Size | degreesOfFreedom (Idx var1, Idx var2) |
Returns the number of degrees of freedom. More... | |
void | setConfidenceProba (double new_proba) |
Modifies the confidence probability. More... | |
static double | probaChi2 (double x, Size df) |
Computes the probability of chi2 value. More... | |
Represent the chi2 distribution.
The class constructor receives a std::vector of unsigned integers. This std::vector represents the variables modalities. The variables indexes in the std::vector will be used as the variables identifiers.
gum::Chi2::Chi2 | ( | const std::vector< std::size_t > & | var_modalities, |
double | confidence_proba = GUM_LEARNING_CONFIDENCE_PROBA |
||
) |
Default constructor.
var_modalities | The variables modalities. |
confidence_proba | The confidence probability. |
Definition at line 56 of file chi2.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::Chi2::~Chi2 | ( | ) |
Class destructor.
Definition at line 63 of file chi2.cpp.
References gum::Set< Key, Alloc >::emplace().
|
privatedelete |
Forbid use of the copy constructor.
Computes the critical value of a given chi2 test (used by the cache).
This code has been written by Gary Perlman.
proba | The probability value. |
df | The number of degrees of freedom. |
Definition at line 173 of file chi2.cpp.
References gum::Set< Key, Alloc >::emplace().
Computes the probability of normal z value.
This code has been written by Gary Perlman.
ALGORITHM Adapted from a polynomial approximation in: Ibbetson D, Algorithm 209 Collected Algorithms of the CACM 1963 p. 616
This routine has six digit accuracy, so it is only useful for absolute z values < 6. For z values >= to 6.0, probaZValue() returns 0.0.
z | A value. |
Definition at line 69 of file chi2.cpp.
References gum::Set< Key, Alloc >::emplace().
Computes the critical value according to the number of degrees of freedom.
pair | A pair of variables ids. |
Definition at line 54 of file chi2_inl.h.
References gum::Set< Key, Alloc >::emplace().
Computes the critical value according to the number of degrees of freedom.
var1 | The first variable id. |
var2 | The second variable id. |
Definition at line 59 of file chi2_inl.h.
References gum::Set< Key, Alloc >::emplace().
Returns the number of degrees of freedom.
pair | A pair of variables ids. |
Definition at line 44 of file chi2_inl.h.
References gum::Set< Key, Alloc >::emplace().
Returns the number of degrees of freedom.
var1 | The first variable id. |
var2 | The second variable id. |
Definition at line 49 of file chi2_inl.h.
References gum::Set< Key, Alloc >::emplace().
Computes the probability of chi2 value.
This code has been written by Gary Perlman.
ALGORITHM Compute probability of chi square value. Adapted from: Hill, I. D. and Pike, M. C. Algorithm 299 Collected Algorithms for the CACM 1967 p. 243 Updated for rounding errors based on remark in ACM TOMS June 1985, page 185
x | The chi2 value. |
df | The number of degrees of freedom. |
Definition at line 126 of file chi2.cpp.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::Chi2::setConditioningNodes | ( | const std::vector< Idx > & | db_conditioning_ids | ) |
Sets the conditioning nodes (useful for computing degrees of freedom).
db_conditioning_ids | The conditioning nodes id. |
Definition at line 36 of file chi2_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::Chi2::setConfidenceProba | ( | double | new_proba | ) |
Modifies the confidence probability.
new_proba | The new confidence probability |
Definition at line 75 of file chi2_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
|
private |
|
private |