45 template <
typename GUM_SCALAR >
48 __conTab.add(iattr, ivalue);
59 template <
typename GUM_SCALAR >
65 for (
auto attrIter = __conTab.attrABeginSafe();
66 attrIter != __conTab.attrAEndSafe();
70 (
double)(attrIter.val()) / (
double)this->nbObservation();
73 for (
auto valIter = __conTab.attrBBeginSafe();
74 valIter != __conTab.attrBEndSafe();
77 Idx cell = __conTab.joint(attrIter.key(), valIter.key());
78 if (cell < 5)
continue;
81 double expected = semiExpected * (
double)valIter.val();
83 __GStat += 2 * cell * log(cell / expected);
91 template <
typename GUM_SCALAR >
93 if (this->_isModified()) computeScore();
98 __GStat, (__conTab.attrASize() - 1) * (__conTab.attrBSize() - 1));
105 template <
typename GUM_SCALAR >
107 if (this->_isModified()) computeScore();
111 template <
typename GUM_SCALAR >
114 __conTab += src.
ct();
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void computeScore() const
Computes the GStat of current variable according to the test.
virtual void computeScore() const
Recomputes the statistic from the beginning.
void addObservation(Idx iattr, GUM_SCALAR ivalue)
Comptabilizes the new observation.
const ContingencyTable< Idx, GUM_SCALAR > & ct() const
Returns contingency table (needed for the merging of GTestPolicy instances)
virtual void addObservation(Idx attr, GUM_SCALAR value)
Comptabilizes the new observation.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
double secondaryscore() const
Returns a second criterion to severe ties.
static double probaChi2(double x, Size df)
computes the probability of chi2 value (used by the cache)
<agrum/multidim/core/testPolicies/GTestPolicy.h>
double score() const
Returns the performance of current variable according to the test.
void add(const ITestPolicy< GUM_SCALAR > &src)
void add(const GTestPolicy< GUM_SCALAR > &src)
Performs the merging of current GTestPolicy instance with given instance.
Size Idx
Type for indexes.