aGrUM  0.16.0
gum::ITestPolicy< GUM_SCALAR > Class Template Referenceabstract

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

Protected Member Functions

bool _isModified () const
 

Detailed Description

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

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

Interface specifying the methods to be implemented by any TestPolicy

Definition at line 50 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 60 of file ITestPolicy.h.

60  : __isModified(false), __nbObs(0) {
61  GUM_CONSTRUCTOR(ITestPolicy);
62  }
ITestPolicy()
Allocators and Deallocators redefinition.
Definition: ITestPolicy.h:60
bool __isModified
Booleans indicating if we have to re eval test.
Definition: ITestPolicy.h:169

◆ ~ITestPolicy()

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

Allocators and Deallocators redefinition.

Definition at line 67 of file ITestPolicy.h.

67 { GUM_DESTRUCTOR(ITestPolicy); }
ITestPolicy()
Allocators and Deallocators redefinition.
Definition: ITestPolicy.h:60

Member Function Documentation

◆ _isModified()

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

Definition at line 165 of file ITestPolicy.h.

References gum::ITestPolicy< GUM_SCALAR >::__isModified.

165 { return __isModified; }
bool __isModified
Booleans indicating if we have to re eval test.
Definition: ITestPolicy.h:169

◆ add()

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

Definition at line 140 of file ITestPolicy.h.

References gum::ITestPolicy< GUM_SCALAR >::__isModified, gum::ITestPolicy< GUM_SCALAR >::__nbObs, and gum::ITestPolicy< GUM_SCALAR >::nbObservation().

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

140  {
141  __isModified = true;
142  __nbObs += src.nbObservation();
143  }
bool __isModified
Booleans indicating if we have to re eval test.
Definition: ITestPolicy.h:169
+ 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::GTestPolicy< GUM_SCALAR >, gum::LeastSquareTestPolicy< GUM_SCALAR >, and gum::Chi2TestPolicy< GUM_SCALAR >.

Definition at line 90 of file ITestPolicy.h.

References gum::ITestPolicy< GUM_SCALAR >::__isModified, and gum::ITestPolicy< GUM_SCALAR >::__nbObs.

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

90  {
91  __isModified = true;
92  __nbObs++;
93  }
bool __isModified
Booleans indicating if we have to re eval test.
Definition: ITestPolicy.h:169
+ 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::GTestPolicy< GUM_SCALAR >, and gum::Chi2TestPolicy< GUM_SCALAR >.

Definition at line 117 of file ITestPolicy.h.

References gum::ITestPolicy< GUM_SCALAR >::__isModified, gum::ITestPolicy< GUM_SCALAR >::score(), and gum::ITestPolicy< GUM_SCALAR >::secondaryscore().

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

117 { __isModified = false; }
bool __isModified
Booleans indicating if we have to re eval test.
Definition: ITestPolicy.h:169
+ Here is the call graph for this function:
+ 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::GTestPolicy< GUM_SCALAR >, gum::LeastSquareTestPolicy< GUM_SCALAR >, and gum::Chi2TestPolicy< GUM_SCALAR >.

Referenced by gum::ITestPolicy< GUM_SCALAR >::nbObservation().

+ Here is the caller graph for this function:

◆ nbObservation()

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

Comptabilizes the new observation.

Definition at line 98 of file ITestPolicy.h.

References gum::ITestPolicy< GUM_SCALAR >::__nbObs, and gum::ITestPolicy< GUM_SCALAR >::isTestRelevant().

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

98 { return __nbObs; }
+ Here is the call graph for this function:
+ 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 75 of file ITestPolicy.h.

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

75  {
77  }
ITestPolicy()
Allocators and Deallocators redefinition.
Definition: ITestPolicy.h:60
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static 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 72 of file ITestPolicy.h.

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

72  {
74  }
void * allocate(const size_t &objectSize)
Allocates a block.
static 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::GTestPolicy< GUM_SCALAR >, and gum::Chi2TestPolicy< GUM_SCALAR >.

Referenced by gum::ITestPolicy< GUM_SCALAR >::computeScore().

+ Here is the caller graph for this function:

◆ 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::LeastSquareTestPolicy< GUM_SCALAR >, gum::GTestPolicy< GUM_SCALAR >, and gum::Chi2TestPolicy< GUM_SCALAR >.

Referenced by gum::ITestPolicy< GUM_SCALAR >::computeScore().

+ Here is the caller graph for this function:

◆ toString()

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

Definition at line 156 of file ITestPolicy.h.

References gum::ITestPolicy< GUM_SCALAR >::__nbObs.

156  {
157  std::stringstream ss;
158  ss << "\t\t\tNb Obs : " << __nbObs << std::endl;
159  return ss.str();
160  }

Member Data Documentation

◆ __isModified

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

◆ __nbObs


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