aGrUM  0.13.2
gum::learning::Cache4PartEntropy Class Reference

a cache for caching partial entropy in PartEntropy classCaching 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. More...

#include <cache4PartEntropy.h>

+ Collaboration diagram for gum::learning::Cache4PartEntropy:

Public Member Functions

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

Detailed Description

a cache for caching partial entropy in PartEntropy class

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.

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

Definition at line 59 of file cache4PartEntropy.h.

Constructor & Destructor Documentation

gum::learning::Cache4PartEntropy::Cache4PartEntropy ( )

default constructor

gum::learning::Cache4PartEntropy::Cache4PartEntropy ( const Cache4PartEntropy from)

copy constructor

gum::learning::Cache4PartEntropy::Cache4PartEntropy ( Cache4PartEntropy &&  from)

move constructor

gum::learning::Cache4PartEntropy::~Cache4PartEntropy ( )

destructor

Member Function Documentation

void gum::learning::Cache4PartEntropy::clear ( )

removes all the stored scores

void gum::learning::Cache4PartEntropy::erase ( const std::vector< Idx > &  var_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::Cache4PartEntropy::erase ( const std::vector< Idx > &  var_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::Cache4PartEntropy::exists ( const std::vector< Idx > &  var_set)

indicates whether a given score exists

void gum::learning::Cache4PartEntropy::insert ( const std::vector< Idx > &  var_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::Cache4PartEntropy::insert ( const std::vector< Idx > &  var_set,
double  score 
)

insert a new score into the cache

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

copy operator

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

move operator

double gum::learning::Cache4PartEntropy::score ( const std::vector< Idx > &  var_set)

returns a given score

Exceptions
NotFoundis raised if the score is not cached

Member Data Documentation

HashTable< std::vector< Idx >, double > gum::learning::Cache4PartEntropy::__scores
private

the scores stored into the cache

Definition at line 134 of file cache4PartEntropy.h.


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