30 #ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_CHI2_TEST_POLICY_H 31 #define GUM_MULTI_DIM_FUNCTION_GRAPH_CHI2_TEST_POLICY_H 34 #include <agrum/FMDP/learning/core/chiSquare.h> 35 #include <agrum/FMDP/learning/core/contingencyTable.h> 36 #include <agrum/FMDP/learning/core/testPolicy/ITestPolicy.h> 50 template <
typename GUM_SCALAR >
54 GUM_CONSTRUCTOR(Chi2TestPolicy);
58 GUM_DESTRUCTOR(Chi2TestPolicy);
65 void*
operator new(size_t s) {
return SmallObjectAllocator::instance().allocate(s); }
67 SmallObjectAllocator::instance().deallocate(p,
sizeof(Chi2TestPolicy));
93 return (
this->nbObservation() > 20 &&
this->nbObservation() > _conTab_.attrASize() * 5);
112 double score()
const;
126 std::stringstream ss;
127 ss << ITestPolicy< GUM_SCALAR >::toString() <<
"\t\t\tContingency Table : " << std::endl
128 << _conTab_.toString() << std::endl
129 <<
"\t\t\tGStat : " <<
this->score() << std::endl
130 <<
"\t\t\tGStat : " <<
this->secondaryscore() << std::endl;
143 #include <agrum/FMDP/learning/core/testPolicy/Chi2TestPolicy_tpl.h>
void * operator new(size_t s)
Allocators and Deallocators redefinition.
void addObservation(Idx attr, GUM_SCALAR value)
Comptabilizes the new observation.
INLINE void emplace(Args &&... args)
<agrum/tools/multidim/core/testPolicy/Chi2TestPolicy.h>
const ContingencyTable< Idx, GUM_SCALAR > & ct() const
virtual double secondaryscore() const
Returns a second criterion to severe ties.
void add(const Chi2TestPolicy< GUM_SCALAR > &src)
virtual ~Chi2TestPolicy()
void computeScore() const
Recomputes the statistic from the beginning.
ContingencyTable< Idx, GUM_SCALAR > _conTab_
The contingency table used to keeps records of all observation.
bool isTestRelevant() const
Returns true if enough observation were made so that the test can be relevant.
double score() const
Returns the performance of current variable according to the test.
void operator delete(void *p)
std::string toString() const