50#ifndef DOXYGEN_SHOULD_SKIP_THIS
80 INLINE
const std::vector< std::pair< std::size_t, std::size_t > >&
Score::ranges()
const {
88 if (
auto ptr_score =
cache_.
tryGet(idset)) {
return *ptr_score; }
89 double the_score =
score_(idset);
93 return score_(std::move(idset));
104 if (
auto ptr_score =
cache_.
tryGet(idset)) {
return *ptr_score; }
105 const double the_score =
score_(idset);
bool isGumNumberOfThreadsOverriden() const override
indicates whether the class containing this ThreadNumberManager set its own number of threads
Size getNumberOfThreads() const override
returns the current max number of threads used by the class containing this ThreadNumberManager
The class representing a tabular database as used by learning tasks.
std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
const std::vector< std::pair< std::size_t, std::size_t > > & ranges() const
returns the current ranges
const DatabaseTable & database() const
returns the database on which we perform the counts
void clear()
clears all the last database-parsed counting from memory
const Bijection< NodeId, std::size_t > & nodeId2Columns() const
returns the mapping from ids to column positions in the database
void setMinNbRowsPerThread(const std::size_t nb) const
changes the number min of rows a thread should process in a multithreading context
void setNumberOfThreads(Size nb) override
sets the number max of threads that can be used
const std::vector< std::pair< std::size_t, std::size_t > > & ranges() const
returns the current ranges
void clear()
clears all the data structures from memory, including the cache
double score(const NodeId var)
returns the score of a single node
const DatabaseTable & database() const
return the database used by the score
virtual std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
const Bijection< NodeId, std::size_t > & nodeId2Columns() const
return the mapping between the columns of the database and the node ids
const std::vector< NodeId > empty_ids_
an empty vector
RecordCounter counter_
the record counter used for the counts over discrete variables
bool isUsingCache() const
indicates whether the score uses a cache
void setNumberOfThreads(Size nb) override
sets the number max of threads that can be used
virtual double score_(const IdCondSet &idset)=0
returns the score for a given IdCondSet
bool use_cache_
a Boolean indicating whether we wish to use the cache
ScoringCache cache_
the scoring cache
bool isGumNumberOfThreadsOverriden() const override
indicates whether the user set herself the number of threads
virtual void setMinNbRowsPerThread(const std::size_t nb) const
changes the number min of rows a thread should process in a multithreading context
void clearCache()
clears the current cache
void useCache(const bool on_off)
turn on/off the use of a cache of the previously computed score
Size getNumberOfThreads() const override
returns the current max number of threads of the scheduler
void insert(const IdCondSet &idset, double score)
insert a new score into the cache
void clear()
removes all the stored scores
optional_ref< double > tryGet(const IdCondSet &idset)
returns a pointer to a given score, or nullptr if not cached
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
include the inlined functions if necessary
class GUM_SHARED_PUBLIC IdCondSet
gum is the global namespace for all aGrUM entities
the base class for all the scores used for learning (BIC, BDeu, etc)