aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::ITestPolicy< GUM_ELEMENT > Class Template Referenceabstract

<agrum/base/multidim/core/testPolicies/ITestPolicy.h> More...

#include <ITestPolicy.h>

Inheritance diagram for gum::ITestPolicy< GUM_ELEMENT >:
Collaboration diagram for gum::ITestPolicy< GUM_ELEMENT >:

Public Member Functions

Constructor/Destructor
 ITestPolicy ()
 Allocators and Deallocators redefinition.
virtual ~ITestPolicy ()
 Allocators and Deallocators redefinition.
void * operator new (size_t s)
 Allocators and Deallocators redefinition.
void operator delete (void *p)
 Allocators and Deallocators redefinition.
Observation methods
virtual void addObservation (Idx attr, GUM_ELEMENT value)
 Comptabilizes the new observation.
Idx nbObservation () const
 Comptabilizes the new observation.
Test methods
virtual bool isTestRelevant () const =0
 Returns true if enough observation were added so that the test can be relevant.
virtual void computeScore () const
 Recomputes the statistic from the beginning.
virtual double score () const =0
 Returns the performance of current variable according to the test.
virtual double secondaryscore () const =0
 Returns a second criterion to severe ties.
Fusion Methods
void add (const ITestPolicy< GUM_ELEMENT > &src)
Miscelleanous Methods
std::string toString () const

Protected Member Functions

bool isModified_ () const

Private Attributes

bool _isModified_
 Booleans indicating if we have to re eval test.
Idx _nbObs_

Detailed Description

template<typename GUM_ELEMENT>
class gum::ITestPolicy< GUM_ELEMENT >

<agrum/base/multidim/core/testPolicies/ITestPolicy.h>

Interface specifying the methods to be implemented by any TestPolicy

Definition at line 71 of file ITestPolicy.h.

Constructor & Destructor Documentation

◆ ITestPolicy()

template<typename GUM_ELEMENT>
gum::ITestPolicy< GUM_ELEMENT >::ITestPolicy ( )

Allocators and Deallocators redefinition.

Definition at line 49 of file ITestPolicy_tpl.h.

49 : _isModified_(false), _nbObs_(0) {
51 }
<agrum/base/multidim/core/testPolicies/ITestPolicy.h>
Definition ITestPolicy.h:71
ITestPolicy()
Allocators and Deallocators redefinition.
bool _isModified_
Booleans indicating if we have to re eval test.

References ITestPolicy(), _isModified_, and _nbObs_.

Referenced by gum::Chi2TestPolicy< GUM_ELEMENT >::Chi2TestPolicy(), gum::GTestPolicy< GUM_ELEMENT >::GTestPolicy(), ITestPolicy(), gum::LeastSquareTestPolicy< GUM_ELEMENT >::LeastSquareTestPolicy(), ~ITestPolicy(), add(), operator delete(), operator new(), and secondaryscore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ITestPolicy()

template<typename GUM_ELEMENT>
gum::ITestPolicy< GUM_ELEMENT >::~ITestPolicy ( )
virtual

Allocators and Deallocators redefinition.

Definition at line 54 of file ITestPolicy_tpl.h.

54 {
56 ;
57 }

References ITestPolicy().

Here is the call graph for this function:

Member Function Documentation

◆ add()

template<typename GUM_ELEMENT>
void gum::ITestPolicy< GUM_ELEMENT >::add ( const ITestPolicy< GUM_ELEMENT > & src)

Definition at line 86 of file ITestPolicy_tpl.h.

86 {
87 _isModified_ = true;
89 }
Idx nbObservation() const
Comptabilizes the new observation.

References ITestPolicy(), _isModified_, _nbObs_, and nbObservation().

Referenced by gum::Chi2TestPolicy< GUM_ELEMENT >::add(), gum::GTestPolicy< GUM_ELEMENT >::add(), and gum::LeastSquareTestPolicy< GUM_ELEMENT >::add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addObservation()

template<typename GUM_ELEMENT>
void gum::ITestPolicy< GUM_ELEMENT >::addObservation ( Idx attr,
GUM_ELEMENT value )
virtual

Comptabilizes the new observation.

Reimplemented in gum::Chi2TestPolicy< GUM_ELEMENT >, gum::GTestPolicy< GUM_ELEMENT >, and gum::LeastSquareTestPolicy< GUM_ELEMENT >.

Definition at line 70 of file ITestPolicy_tpl.h.

70 {
71 _isModified_ = true;
72 _nbObs_++;
73 }

References _isModified_, and _nbObs_.

Referenced by gum::Chi2TestPolicy< GUM_ELEMENT >::addObservation(), gum::GTestPolicy< GUM_ELEMENT >::addObservation(), and gum::LeastSquareTestPolicy< GUM_ELEMENT >::addObservation().

Here is the caller graph for this function:

◆ computeScore()

template<typename GUM_ELEMENT>
void gum::ITestPolicy< GUM_ELEMENT >::computeScore ( ) const
virtual

Recomputes the statistic from the beginning.

Reimplemented in gum::Chi2TestPolicy< GUM_ELEMENT >, and gum::GTestPolicy< GUM_ELEMENT >.

Definition at line 81 of file ITestPolicy_tpl.h.

81 {
82 _isModified_ = false;
83 }

References _isModified_.

Referenced by gum::Chi2TestPolicy< GUM_ELEMENT >::computeScore(), gum::GTestPolicy< GUM_ELEMENT >::computeScore(), and gum::LeastSquareTestPolicy< GUM_ELEMENT >::computeScore().

Here is the caller graph for this function:

◆ isModified_()

template<typename GUM_ELEMENT>
bool gum::ITestPolicy< GUM_ELEMENT >::isModified_ ( ) const
protected

Definition at line 97 of file ITestPolicy_tpl.h.

97 {
98 return _isModified_;
99 }

References _isModified_.

Referenced by gum::Chi2TestPolicy< GUM_ELEMENT >::score(), gum::GTestPolicy< GUM_ELEMENT >::score(), gum::LeastSquareTestPolicy< GUM_ELEMENT >::score(), gum::Chi2TestPolicy< GUM_ELEMENT >::secondaryscore(), gum::GTestPolicy< GUM_ELEMENT >::secondaryscore(), and gum::LeastSquareTestPolicy< GUM_ELEMENT >::secondaryscore().

Here is the caller graph for this function:

◆ isTestRelevant()

template<typename GUM_ELEMENT>
virtual bool gum::ITestPolicy< GUM_ELEMENT >::isTestRelevant ( ) const
pure virtual

Returns true if enough observation were added so that the test can be relevant.

Implemented in gum::Chi2TestPolicy< GUM_ELEMENT >, gum::GTestPolicy< GUM_ELEMENT >, and gum::LeastSquareTestPolicy< GUM_ELEMENT >.

◆ nbObservation()

template<typename GUM_ELEMENT>
Idx gum::ITestPolicy< GUM_ELEMENT >::nbObservation ( ) const

Comptabilizes the new observation.

Definition at line 76 of file ITestPolicy_tpl.h.

76 {
77 return _nbObs_;
78 }

References _nbObs_.

Referenced by add(), gum::Chi2TestPolicy< GUM_ELEMENT >::computeScore(), gum::GTestPolicy< GUM_ELEMENT >::computeScore(), gum::LeastSquareTestPolicy< GUM_ELEMENT >::computeScore(), gum::Chi2TestPolicy< GUM_ELEMENT >::isTestRelevant(), gum::GTestPolicy< GUM_ELEMENT >::isTestRelevant(), and gum::LeastSquareTestPolicy< GUM_ELEMENT >::isTestRelevant().

Here is the caller graph for this function:

◆ operator delete()

template<typename GUM_ELEMENT>
void gum::ITestPolicy< GUM_ELEMENT >::operator delete ( void * p)

Allocators and Deallocators redefinition.

Definition at line 65 of file ITestPolicy_tpl.h.

65 {
67 }
static SmallObjectAllocator & instance()
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.

References ITestPolicy(), gum::SmallObjectAllocator::deallocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ operator new()

template<typename GUM_ELEMENT>
void * gum::ITestPolicy< GUM_ELEMENT >::operator new ( size_t s)

Allocators and Deallocators redefinition.

Definition at line 60 of file ITestPolicy_tpl.h.

60 {
62 }
void * allocate(const size_t &objectSize)
Allocates a block.

References ITestPolicy(), gum::SmallObjectAllocator::allocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ score()

template<typename GUM_ELEMENT>
virtual double gum::ITestPolicy< GUM_ELEMENT >::score ( ) const
pure virtual

Returns the performance of current variable according to the test.

Implemented in gum::Chi2TestPolicy< GUM_ELEMENT >, and gum::GTestPolicy< GUM_ELEMENT >.

◆ secondaryscore()

template<typename GUM_ELEMENT>
virtual double gum::ITestPolicy< GUM_ELEMENT >::secondaryscore ( ) const
pure virtual

Returns a second criterion to severe ties.

Implemented in gum::Chi2TestPolicy< GUM_ELEMENT >, gum::GTestPolicy< GUM_ELEMENT >, and gum::LeastSquareTestPolicy< GUM_ELEMENT >.

References ITestPolicy().

Here is the call graph for this function:

◆ toString()

template<typename GUM_ELEMENT>
std::string gum::ITestPolicy< GUM_ELEMENT >::toString ( ) const

Definition at line 92 of file ITestPolicy_tpl.h.

92 {
93 return std::format("\t\t\tNb Obs : {}\n", _nbObs_);
94 }

References _nbObs_.

Referenced by gum::Chi2TestPolicy< GUM_ELEMENT >::toString(), and gum::GTestPolicy< GUM_ELEMENT >::toString().

Here is the caller graph for this function:

Member Data Documentation

◆ _isModified_

template<typename GUM_ELEMENT>
bool gum::ITestPolicy< GUM_ELEMENT >::_isModified_
mutableprivate

Booleans indicating if we have to re eval test.

Definition at line 175 of file ITestPolicy.h.

Referenced by ITestPolicy(), add(), addObservation(), computeScore(), and isModified_().

◆ _nbObs_

template<typename GUM_ELEMENT>
Idx gum::ITestPolicy< GUM_ELEMENT >::_nbObs_
private

Definition at line 178 of file ITestPolicy.h.

Referenced by ITestPolicy(), add(), addObservation(), nbObservation(), and toString().


The documentation for this class was generated from the following files: