aGrUM  0.13.2
gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc > Class Template Reference

class CorrectedMutualInformation, used in the 3off2 algorithm More...

#include <correctedMutualInformation.h>

+ Collaboration diagram for gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >:

Public Member Functions

const Size N ()
 Size of the database. More...
 
Constructors and destructors
template<typename RowFilter >
 CorrectedMutualInformation (const RowFilter &filter, const std::vector< Size > &var_modalities)
 
virtual ~CorrectedMutualInformation ()
 
functions for cache

clears all the data structures from memory

virtual void clear ()
 clears the current cache (clear nodesets as well) More...
 
virtual void clearCache ()
 clears the current cache (clear nodesets as well) More...
 
void useKCache (bool on_off) noexcept
 turn on/off the use of a cache of the previously computed K score More...
 
void useCache (bool on_off) noexcept
 turn on/off the use of a cache of the previously computed score More...
 
score function, used to declare the variables

returns the 2-point mutual information corresponding to a given nodeset

double score (Idx var1, Idx var2)
 returns the 2-point mutual information corresponding to a given nodeset More...
 
double score (Idx var1, Idx var2, const std::vector< Idx > &conditioning_ids)
 returns the 2-point mutual information corresponding to a given nodeset More...
 
double score (const std::pair< Idx, Idx > &vars)
 returns the 2-point mutual information corresponding to a given nodeset More...
 
double score (const std::pair< Idx, Idx > &vars, const std::vector< Idx > &conditioning_ids)
 returns the 2-point mutual information corresponding to a given nodeset More...
 
double score (Idx var1, Idx var2, Idx var3)
 returns the 3-point mutual information corresponding to a given nodeset More...
 
double score (const std::tuple< Idx, Idx, Idx > &vars)
 returns the 3-point mutual information corresponding to a given nodeset More...
 
double score (Idx var1, Idx var2, Idx var3, const std::vector< Idx > &conditioning_ids)
 returns the 3-point mutual information corresponding to a given nodeset More...
 
double score (const std::tuple< Idx, Idx, Idx > &vars, const std::vector< Idx > &conditioning_ids)
 returns the 3-point mutual information corresponding to a given nodeset More...
 
functions to choose which correction to use
void useMDL ()
 
void useNML ()
 
void useNoCorr ()
 

Public Types

enum  KModeTypes { KModeTypes::MDL, KModeTypes::NML, KModeTypes::NoCorr }
 the description type for the complexity correction More...
 

Protected Attributes

PartialEntropy< IdSetAlloc, CountAlloc > _H
 
const std::vector< Idx__empty_conditioning_set
 an empty conditioning set More...
 
bool __use_cache {true}
 a Boolean indicating whether we wish to use the cache More...
 
bool __use_Kcache {true}
 a Boolean indicating whether we wish to use the Kcache More...
 

Protected Member Functions

virtual double _I_score (Idx var1, Idx var2, const std::vector< Idx > &conditioning_ids)
 returns the 2-point mutual information corresponding to a given nodeset More...
 
virtual double _I_score (Idx var1, Idx var2, Idx var3, const std::vector< Idx > &conditioning_ids)
 returns the 3-point mutual information corresponding to a given nodeset More...
 
virtual double _score (Idx var1, Idx var2, const std::vector< Idx > &conditioning_ids)
 returns the 2-point corrected mutual information corresponding to a given nodeset More...
 
virtual double _score (Idx var1, Idx var2, Idx var3, const std::vector< Idx > &conditioning_ids)
 returns the 3-point corrected mutual information corresponding to a given nodeset More...
 
void _insertIntoCache (Idx var1, Idx var2, const std::vector< Idx > &conditioning_ids, double score)
 inserts a new score into the cache More...
 
void _insertIntoCache (Idx var1, Idx var2, Idx var3, const std::vector< Idx > &conditioning_ids, double score)
 inserts a new score into the cache More...
 
bool _isUsingCache () const noexcept
 indicates whether we use the cache or not More...
 
double _K (Idx var1, Idx var2, const std::vector< Idx > &conditioning_ids)
 computes the complexity correction for the mutual information More...
 
double _K (Idx var1, Idx var2, Idx var3, const std::vector< Idx > &conditioning_ids)
 
void _insertIntoKCache (Idx var1, Idx var2, const std::vector< Idx > &conditioning_ids, double score)
 inserts a new score into the cache More...
 
void _insertIntoKCache (Idx var1, Idx var2, Idx var3, const std::vector< Idx > &conditioning_ids, double score)
 inserts a new score into the cache More...
 

Detailed Description

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
class gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >

class CorrectedMutualInformation, used in the 3off2 algorithm

This class handles the computations and storage of the mutual information values used in 3off2 and potential corrections.

Definition at line 59 of file correctedMutualInformation.h.

Member Enumeration Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
enum gum::learning::CorrectedMutualInformation::KModeTypes
strong

the description type for the complexity correction

Enumerator
MDL 
NML 
NoCorr 

Definition at line 137 of file correctedMutualInformation.h.

137 { MDL, NML, NoCorr };

Constructor & Destructor Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
template<typename RowFilter >
gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::CorrectedMutualInformation ( const RowFilter &  filter,
const std::vector< Size > &  var_modalities 
)
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::~CorrectedMutualInformation ( )
virtual

Member Function Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_I_score ( Idx  var1,
Idx  var2,
const std::vector< Idx > &  conditioning_ids 
)
protectedvirtual

returns the 2-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_I_score ( Idx  var1,
Idx  var2,
Idx  var3,
const std::vector< Idx > &  conditioning_ids 
)
protectedvirtual

returns the 3-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_insertIntoCache ( Idx  var1,
Idx  var2,
const std::vector< Idx > &  conditioning_ids,
double  score 
)
protected

inserts a new score into the cache

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_insertIntoCache ( Idx  var1,
Idx  var2,
Idx  var3,
const std::vector< Idx > &  conditioning_ids,
double  score 
)
protected

inserts a new score into the cache

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_insertIntoKCache ( Idx  var1,
Idx  var2,
const std::vector< Idx > &  conditioning_ids,
double  score 
)
protected

inserts a new score into the cache

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_insertIntoKCache ( Idx  var1,
Idx  var2,
Idx  var3,
const std::vector< Idx > &  conditioning_ids,
double  score 
)
protected

inserts a new score into the cache

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
bool gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_isUsingCache ( ) const
protectednoexcept

indicates whether we use the cache or not

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_K ( Idx  var1,
Idx  var2,
const std::vector< Idx > &  conditioning_ids 
)
protected

computes the complexity correction for the mutual information

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_K ( Idx  var1,
Idx  var2,
Idx  var3,
const std::vector< Idx > &  conditioning_ids 
)
protected
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_score ( Idx  var1,
Idx  var2,
const std::vector< Idx > &  conditioning_ids 
)
protectedvirtual

returns the 2-point corrected mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_score ( Idx  var1,
Idx  var2,
Idx  var3,
const std::vector< Idx > &  conditioning_ids 
)
protectedvirtual

returns the 3-point corrected mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::clear ( )
virtual

clears the current cache (clear nodesets as well)

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::clearCache ( )
virtual

clears the current cache (clear nodesets as well)

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const Size gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::N ( )

Size of the database.

Referenced by gum::learning::Miic::_findBestContributor().

+ Here is the caller graph for this function:

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( Idx  var1,
Idx  var2 
)

returns the 2-point mutual information corresponding to a given nodeset

Referenced by gum::learning::Miic::_findBestContributor(), gum::learning::Miic::_getUnshieldedTriples(), gum::learning::Miic::_getUnshieldedTriplesMIIC(), gum::learning::Miic::_initiation(), and gum::learning::Miic::_iteration().

+ Here is the caller graph for this function:

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( Idx  var1,
Idx  var2,
const std::vector< Idx > &  conditioning_ids 
)

returns the 2-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( const std::pair< Idx, Idx > &  vars)

returns the 2-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( const std::pair< Idx, Idx > &  vars,
const std::vector< Idx > &  conditioning_ids 
)

returns the 2-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( Idx  var1,
Idx  var2,
Idx  var3 
)

returns the 3-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( const std::tuple< Idx, Idx, Idx > &  vars)

returns the 3-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( Idx  var1,
Idx  var2,
Idx  var3,
const std::vector< Idx > &  conditioning_ids 
)

returns the 3-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::score ( const std::tuple< Idx, Idx, Idx > &  vars,
const std::vector< Idx > &  conditioning_ids 
)

returns the 3-point mutual information corresponding to a given nodeset

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::useCache ( bool  on_off)
noexcept

turn on/off the use of a cache of the previously computed score

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::useKCache ( bool  on_off)
noexcept

turn on/off the use of a cache of the previously computed K score

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::useMDL ( )

Referenced by gum::learning::genericBNLearner::useMDL().

+ Here is the caller graph for this function:

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::useNML ( )

Referenced by gum::learning::genericBNLearner::useNML().

+ Here is the caller graph for this function:

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::useNoCorr ( )

Referenced by gum::learning::genericBNLearner::useNoCorr().

+ Here is the caller graph for this function:

Member Data Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Cache4IndepTest gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__cache_2pt
private

a cache for the previously computed scores

Definition at line 213 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Cache43ptInfo gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__cache_3pt
private

Definition at line 214 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Cache4IndepTest gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__cache_K2pt
private

a cache for the previously computed K scores

Definition at line 217 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Cache43ptInfo gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__cache_K3pt
private

Definition at line 218 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< Idx > gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__empty_conditioning_set
protected

an empty conditioning set

Definition at line 166 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
KNML< IdSetAlloc, CountAlloc > gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__k_NML
private

the object computing the NML k score

Definition at line 221 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
KModeTypes gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__kmode {KModeTypes::MDL}
private

the mode used for the correction

Definition at line 225 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
std::vector< Size > gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__modalities
private

variables modalities

Definition at line 228 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const double gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__threshold {1e-10}
private

Definition at line 230 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
bool gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__use_cache {true}
protected

a Boolean indicating whether we wish to use the cache

Definition at line 206 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
bool gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::__use_Kcache {true}
protected

a Boolean indicating whether we wish to use the Kcache

Definition at line 209 of file correctedMutualInformation.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
PartialEntropy< IdSetAlloc, CountAlloc > gum::learning::CorrectedMutualInformation< IdSetAlloc, CountAlloc >::_H
protected

Definition at line 163 of file correctedMutualInformation.h.


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