67 template <
typename GUM_SCALAR >
80 template <
typename GUM_SCALAR >
86 for (
auto attrIter =
_conTab_.attrABeginSafe(); attrIter !=
_conTab_.attrAEndSafe();
92 for (
auto valIter =
_conTab_.attrBBeginSafe(); valIter !=
_conTab_.attrBEndSafe();
95 Idx cell =
_conTab_.joint(attrIter.key(), valIter.key());
96 if (cell < 5)
continue;
99 double expected = semiExpected * (
double)valIter.val();
101 _GStat_ += 2 * cell * log(cell / expected);
109 template <
typename GUM_SCALAR >
122 template <
typename GUM_SCALAR >
128 template <
typename GUM_SCALAR >
Headers of the GTestPolicy.
static double probaChi2(double x, Size df)
computes the probability of chi2 value (used by the cache)
GTestPolicy()
Constructor.
const ContingencyTable< Idx, GUM_SCALAR > & ct() const
Returns contingency table (needed for the merging of GTestPolicy instances).
double secondaryscore() const
Returns a second criterion to severe ties.
void addObservation(Idx iattr, GUM_SCALAR ivalue)
Comptabilizes the new observation.
double score() const
Returns the performance of current variable according to the test.
void add(const GTestPolicy< GUM_SCALAR > &src)
Performs the merging of current GTestPolicy instance with given instance.
void computeScore() const
Computes the GStat of current variable according to the test.
ContingencyTable< Idx, GUM_SCALAR > _conTab_
The contingency table used to keeps records of all observation.
Idx nbObservation() const
Comptabilizes the new observation.
virtual void computeScore() const
Recomputes the statistic from the beginning.
virtual void addObservation(Idx attr, GUM_SCALAR value)
Comptabilizes the new observation.
void add(const ITestPolicy< GUM_SCALAR > &src)
Size Idx
Type for indexes.
gum is the global namespace for all aGrUM entities