aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::learning::ScoringCache Class Reference

a cache for caching scores and independence tests results More...

#include <agrum/base/database/scoringCache.h>

Public Member Functions

Constructors / Destructors
 ScoringCache ()
 default constructor
 ScoringCache (const ScoringCache &from)
 copy constructor
 ScoringCache (ScoringCache &&from)
 move constructor
virtual ScoringCacheclone () const
 virtual copy constructor
virtual ~ScoringCache ()
 destructor
Operators
ScoringCacheoperator= (const ScoringCache &from)
 copy operator
ScoringCacheoperator= (ScoringCache &&from)
 move operator
Accessors / Modifiers
void insert (const IdCondSet &idset, double score)
 insert a new score into the cache
void insert (IdCondSet &&idset, double score)
 insert a new score into the cache
void erase (const IdCondSet &idset)
 removes a score (if it exists)
bool exists (const IdCondSet &idset)
 indicates whether a given score exists
double score (const IdCondSet &idset)
 returns a given score
void clear ()
 removes all the stored scores
std::size_t size () const
 returns the number of scores saved in the cache

Detailed Description

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 79 of file scoringCache.h.

Constructor & Destructor Documentation

◆ ScoringCache() [1/3]

gum::learning::ScoringCache::ScoringCache ( )

default constructor

Referenced by ScoringCache(), ScoringCache(), clone(), operator=(), and operator=().

Here is the caller graph for this function:

◆ ScoringCache() [2/3]

gum::learning::ScoringCache::ScoringCache ( const ScoringCache & from)

copy constructor

References ScoringCache().

Here is the call graph for this function:

◆ ScoringCache() [3/3]

gum::learning::ScoringCache::ScoringCache ( ScoringCache && from)

move constructor

References ScoringCache().

Here is the call graph for this function:

◆ ~ScoringCache()

virtual gum::learning::ScoringCache::~ScoringCache ( )
virtual

destructor

Member Function Documentation

◆ clear()

void gum::learning::ScoringCache::clear ( )

removes all the stored scores

◆ clone()

virtual ScoringCache * gum::learning::ScoringCache::clone ( ) const
virtual

virtual copy constructor

References ScoringCache().

Here is the call graph for this function:

◆ erase()

void gum::learning::ScoringCache::erase ( const IdCondSet & idset)

removes a score (if it exists)

Parameters
idsetthe IdCondSet storing the sets of variables
Warning
If the score does not exist, nothing is done. In particular, no exception is raised

◆ exists()

bool gum::learning::ScoringCache::exists ( const IdCondSet & idset)

indicates whether a given score exists

Parameters
idsetthe IdCondSet storing the sets of variables

◆ insert() [1/2]

void gum::learning::ScoringCache::insert ( const IdCondSet & idset,
double score )

insert a new score into the cache

Parameters
idsetthe IdCondSet storing the sets of variables
scorethe score assigned to the IdCondSet
Exceptions
DuplicateElementexception is raised if a score for the same variables already exists

References score().

Here is the call graph for this function:

◆ insert() [2/2]

void gum::learning::ScoringCache::insert ( IdCondSet && idset,
double score )

insert a new score into the cache

Parameters
idsetthe IdCondSet storing the sets of variables
scorethe score assigned to the IdCondSet
Exceptions
DuplicateElementexception is raised if a score for the same variables already exists

References score().

Here is the call graph for this function:

◆ operator=() [1/2]

ScoringCache & gum::learning::ScoringCache::operator= ( const ScoringCache & from)

copy operator

References ScoringCache().

Here is the call graph for this function:

◆ operator=() [2/2]

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

move operator

References ScoringCache().

Here is the call graph for this function:

◆ score()

double gum::learning::ScoringCache::score ( const IdCondSet & idset)

returns a given score

Parameters
idsetthe IdCondSet storing the sets of variables
Exceptions
NotFoundis raised if the score is not cached

Referenced by insert(), and insert().

Here is the caller graph for this function:

◆ size()

std::size_t gum::learning::ScoringCache::size ( ) const

returns the number of scores saved in the cache


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