![]() |
aGrUM
0.16.0
|
a cache for caching scores and independence tests resultsCaching previously computed scores or the results of conditional independence tests is very important for learning algorithms because computing a score or an independence test requires parsing the database and this is the most time consuming operation in learning. More...
#include <agrum/learning/database/scoringCache.h>
Inherits ALLOC< NodeId >.
Public Member Functions | |
Constructors / Destructors | |
ScoringCache (const allocator_type &alloc=allocator_type()) | |
default constructor More... | |
ScoringCache (const ScoringCache< ALLOC > &from) | |
copy constructor More... | |
ScoringCache (const ScoringCache< ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
ScoringCache (ScoringCache< ALLOC > &&from) | |
move constructor More... | |
ScoringCache (ScoringCache< ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
virtual ScoringCache< ALLOC > * | clone () const |
virtual copy constructor More... | |
virtual ScoringCache< ALLOC > * | clone (const allocator_type &alloc) const |
virtual copy constructor with a given allocator More... | |
virtual | ~ScoringCache () |
destructor More... | |
Operators | |
ScoringCache< ALLOC > & | operator= (const ScoringCache< ALLOC > &from) |
copy operator More... | |
ScoringCache< ALLOC > & | operator= (ScoringCache< ALLOC > &&from) |
move operator More... | |
Accessors / Modifiers | |
void | insert (const IdSet< ALLOC > &idset, double score) |
insert a new score into the cache More... | |
void | insert (IdSet< ALLOC > &&idset, double score) |
insert a new score into the cache More... | |
void | erase (const IdSet< ALLOC > &idset) |
removes a score (if it exists) More... | |
bool | exists (const IdSet< ALLOC > &idset) |
indicates whether a given score exists More... | |
double | score (const IdSet< ALLOC > &idset) |
returns a given score More... | |
void | clear () |
removes all the stored scores More... | |
std::size_t | size () const |
returns the number of scores saved in the cache More... | |
allocator_type | getAllocator () const |
returns the allocator used by the translator More... | |
Public Types | |
using | allocator_type = ALLOC< NodeId > |
type for the allocators passed in arguments of methods More... | |
a cache for caching scores and independence tests results
Caching previously computed scores or the results of conditional independence tests is very important for learning algorithms because computing a score or an independence test 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 learning computational burden.
Definition at line 60 of file scoringCache.h.
using gum::learning::ScoringCache< ALLOC >::allocator_type = ALLOC< NodeId > |
type for the allocators passed in arguments of methods
Definition at line 63 of file scoringCache.h.
gum::learning::ScoringCache< ALLOC >::ScoringCache | ( | const allocator_type & | alloc = allocator_type() | ) |
default constructor
gum::learning::ScoringCache< ALLOC >::ScoringCache | ( | const ScoringCache< ALLOC > & | from | ) |
copy constructor
gum::learning::ScoringCache< ALLOC >::ScoringCache | ( | const ScoringCache< ALLOC > & | from, |
const allocator_type & | alloc | ||
) |
copy constructor with a given allocator
gum::learning::ScoringCache< ALLOC >::ScoringCache | ( | ScoringCache< ALLOC > && | from | ) |
move constructor
gum::learning::ScoringCache< ALLOC >::ScoringCache | ( | ScoringCache< ALLOC > && | from, |
const allocator_type & | alloc | ||
) |
move constructor with a given allocator
|
virtual |
destructor
void gum::learning::ScoringCache< ALLOC >::clear | ( | ) |
removes all the stored scores
|
virtual |
virtual copy constructor
|
virtual |
virtual copy constructor with a given allocator
void gum::learning::ScoringCache< ALLOC >::erase | ( | const IdSet< ALLOC > & | idset | ) |
removes a score (if it exists)
idset | the IdSet storing the sets of variables |
bool gum::learning::ScoringCache< ALLOC >::exists | ( | const IdSet< ALLOC > & | idset | ) |
indicates whether a given score exists
idset | the IdSet storing the sets of variables |
allocator_type gum::learning::ScoringCache< ALLOC >::getAllocator | ( | ) | const |
returns the allocator used by the translator
void gum::learning::ScoringCache< ALLOC >::insert | ( | const IdSet< ALLOC > & | idset, |
double | score | ||
) |
insert a new score into the cache
DuplicateElement | exception is raised if a score for the same variables already exists |
void gum::learning::ScoringCache< ALLOC >::insert | ( | IdSet< ALLOC > && | idset, |
double | score | ||
) |
insert a new score into the cache
DuplicateElement | exception is raised if a score for the same variables already exists |
ScoringCache< ALLOC >& gum::learning::ScoringCache< ALLOC >::operator= | ( | const ScoringCache< ALLOC > & | from | ) |
copy operator
ScoringCache< ALLOC >& gum::learning::ScoringCache< ALLOC >::operator= | ( | ScoringCache< ALLOC > && | from | ) |
move operator
double gum::learning::ScoringCache< ALLOC >::score | ( | const IdSet< ALLOC > & | idset | ) |
std::size_t gum::learning::ScoringCache< ALLOC >::size | ( | ) | const |
returns the number of scores saved in the cache