aGrUM  0.13.2
gum::learning::Cache4Score Class Reference

a cache for caching 3 points mutual information in 3off2Caching previously computed scores is very important for learning algorithms because computing independence tests requires parsing the database and this is the most time consuming operation in learning. More...

#include <cache4Score.h>

+ Collaboration diagram for gum::learning::Cache4Score:

Public Member Functions

Constructors / Destructors
 Cache4Score ()
 default constructor More...
 
 Cache4Score (const Cache4Score &from)
 copy constructor More...
 
 Cache4Score (Cache4Score &&from)
 move constructor More...
 
 ~Cache4Score ()
 destructor More...
 
Operators
Cache4Scoreoperator= (const Cache4Score &from)
 copy operator More...
 
Cache4Scoreoperator= (Cache4Score &&from)
 move operator More...
 
Accessors / Modifiers
void insert (Idx var, const std::vector< Idx > &conditioning_set, double score)
 insert a new score into the cache More...
 
template<typename Alloc >
void insert (Idx var, IdSet< Alloc > &conditioning_set, double score)
 insert a new score into the cache More...
 
void erase (Idx var, const std::vector< Idx > &conditioning_set)
 removes a score (if it exists) More...
 
template<typename Alloc >
void erase (Idx var, const IdSet< Alloc > &conditioning_set)
 removes a score (if it exists) More...
 
bool exists (Idx var, const std::vector< Idx > &conditioning_set)
 indicates whether a given score exists More...
 
double score (Idx var, const std::vector< Idx > &conditioning_set)
 returns a given score More...
 
void clear ()
 removes all the stored scores More...
 

Detailed Description

a cache for caching 3 points mutual information in 3off2

Caching previously computed scores is very important for learning algorithms because computing independence tests requires parsing the database and this is the most time consuming operation in learning.

a cache for caching scores in Score classes (BIC, BDeu, K2, etc.)

Caching previously computed scores is very important for learning algorithms because computing a score requires parsing the database and this is the most time consuming operation in learning.

a cache for caching scores in Indep Test classes (chi2, G2, etc.)

Caching previously computed scores is very important for learning algorithms because computing independence tests requires parsing the database and this is the most time consuming operation in learning.

This class provides an efficient cache that can significantly alleviate the scoring burden.

Definition at line 59 of file cache4Score.h.

Constructor & Destructor Documentation

gum::learning::Cache4Score::Cache4Score ( )

default constructor

gum::learning::Cache4Score::Cache4Score ( const Cache4Score from)

copy constructor

gum::learning::Cache4Score::Cache4Score ( Cache4Score &&  from)

move constructor

gum::learning::Cache4Score::~Cache4Score ( )

destructor

Member Function Documentation

void gum::learning::Cache4Score::clear ( )

removes all the stored scores

void gum::learning::Cache4Score::erase ( Idx  var,
const std::vector< Idx > &  conditioning_set 
)

removes a score (if it exists)

If the score does not exist, nothing is done. In particular, no exception is raised

template<typename Alloc >
void gum::learning::Cache4Score::erase ( Idx  var,
const IdSet< Alloc > &  conditioning_set 
)

removes a score (if it exists)

If the score does not exist, nothing is done. In particular, no exception is raised

bool gum::learning::Cache4Score::exists ( Idx  var,
const std::vector< Idx > &  conditioning_set 
)

indicates whether a given score exists

void gum::learning::Cache4Score::insert ( Idx  var,
const std::vector< Idx > &  conditioning_set,
double  score 
)

insert a new score into the cache

Exceptions
DuplicateElementexception is raised if a score for the same variables already exists
template<typename Alloc >
void gum::learning::Cache4Score::insert ( Idx  var,
IdSet< Alloc > &  conditioning_set,
double  score 
)

insert a new score into the cache

Exceptions
DuplicateElementexception is raised if a score for the same variables already exists
Cache4Score& gum::learning::Cache4Score::operator= ( const Cache4Score from)

copy operator

Cache4Score& gum::learning::Cache4Score::operator= ( Cache4Score &&  from)

move operator

double gum::learning::Cache4Score::score ( Idx  var,
const std::vector< Idx > &  conditioning_set 
)

returns a given score

Exceptions
NotFoundis raised if the score is not cached

Member Data Documentation

HashTable< std::pair< IdSet<>, Idx >, double > gum::learning::Cache4Score::__scores
private

the scores stored into the cache

Definition at line 135 of file cache4Score.h.


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