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

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

#include <ITestPolicy.h>

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

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_SCALAR 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_SCALAR > &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_SCALAR>
class gum::ITestPolicy< GUM_SCALAR >

<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_SCALAR>
gum::ITestPolicy< GUM_SCALAR >::ITestPolicy ( )
inline

Allocators and Deallocators redefinition.

Definition at line 81 of file ITestPolicy.h.

<agrum/base/multidim/core/testPolicies/ITestPolicy.h>
Definition ITestPolicy.h:71
ITestPolicy()
Allocators and Deallocators redefinition.
Definition ITestPolicy.h:81
bool _isModified_
Booleans indicating if we have to re eval test.

References ITestPolicy(), _isModified_, and _nbObs_.

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

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

◆ ~ITestPolicy()

template<typename GUM_SCALAR>
virtual gum::ITestPolicy< GUM_SCALAR >::~ITestPolicy ( )
inlinevirtual

Allocators and Deallocators redefinition.

Definition at line 86 of file ITestPolicy.h.

86 {
88 ;
89 }

References ITestPolicy().

Here is the call graph for this function:

Member Function Documentation

◆ add()

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

Definition at line 161 of file ITestPolicy.h.

161 {
162 _isModified_ = true;
164 }
Idx nbObservation() const
Comptabilizes the new observation.

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

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

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

◆ addObservation()

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

Comptabilizes the new observation.

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

Definition at line 111 of file ITestPolicy.h.

111 {
112 _isModified_ = true;
113 _nbObs_++;
114 }

References _isModified_, and _nbObs_.

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

Here is the caller graph for this function:

◆ computeScore()

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

Recomputes the statistic from the beginning.

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

Definition at line 138 of file ITestPolicy.h.

138{ _isModified_ = false; }

References _isModified_.

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

Here is the caller graph for this function:

◆ isModified_()

template<typename GUM_SCALAR>
bool gum::ITestPolicy< GUM_SCALAR >::isModified_ ( ) const
inlineprotected

Definition at line 186 of file ITestPolicy.h.

186{ return _isModified_; }

References _isModified_.

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

Here is the caller graph for this function:

◆ isTestRelevant()

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

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

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

◆ nbObservation()

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

Comptabilizes the new observation.

Definition at line 119 of file ITestPolicy.h.

119{ return _nbObs_; }

References _nbObs_.

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

Here is the caller graph for this function:

◆ operator delete()

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

Allocators and Deallocators redefinition.

Definition at line 96 of file ITestPolicy.h.

96 {
98 }
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_SCALAR>
void * gum::ITestPolicy< GUM_SCALAR >::operator new ( size_t s)
inline

Allocators and Deallocators redefinition.

Definition at line 94 of file ITestPolicy.h.

void * allocate(const size_t &objectSize)
Allocates a block.

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

Here is the call graph for this function:

◆ score()

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

Returns the performance of current variable according to the test.

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

◆ secondaryscore()

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

Returns a second criterion to severe ties.

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

◆ toString()

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

Definition at line 177 of file ITestPolicy.h.

177 {
179 ss << "\t\t\tNb Obs : " << _nbObs_ << std::endl;
180 return ss.str();
181 }

References _nbObs_.

Member Data Documentation

◆ _isModified_

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

Booleans indicating if we have to re eval test.

Definition at line 190 of file ITestPolicy.h.

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

◆ _nbObs_

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

Definition at line 193 of file ITestPolicy.h.

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


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