42 template <
typename GUM_SCALAR >
45 __conTab.add(iattr, ivalue);
56 template <
typename GUM_SCALAR >
62 for (
auto attrIter = __conTab.attrABeginSafe();
63 attrIter != __conTab.attrAEndSafe();
67 (
double)(attrIter.val()) / (
double)this->nbObservation();
70 for (
auto valIter = __conTab.attrBBeginSafe();
71 valIter != __conTab.attrBEndSafe();
74 Idx cell = __conTab.joint(attrIter.key(), valIter.key());
75 if (cell < 5)
continue;
78 double expected = semiExpected * (
double)valIter.val();
80 __GStat += 2 * cell * log(cell / expected);
88 template <
typename GUM_SCALAR >
90 if (this->_isModified()) computeScore();
95 __GStat, (__conTab.attrASize() - 1) * (__conTab.attrBSize() - 1));
102 template <
typename GUM_SCALAR >
104 if (this->_isModified()) computeScore();
108 template <
typename GUM_SCALAR >
111 __conTab += src.
ct();
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.
gum is the global namespace for all aGrUM entities
Headers of the GTestPolicy.
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.