Common counting infrastructure shared by IndependenceTest and KNML.
More...
#include <agrum/base/stattests/cachedContingencyCounter.h>
|
| | CachedContingencyCounter (const DBRowGeneratorParser &parser, const Prior &prior, const std::vector< std::pair< std::size_t, std::size_t > > &ranges, const Bijection< NodeId, std::size_t > &nodeId2columns=Bijection< NodeId, std::size_t >()) |
| | default constructor
|
| | CachedContingencyCounter (const DBRowGeneratorParser &parser, const Prior &prior, const Bijection< NodeId, std::size_t > &nodeId2columns=Bijection< NodeId, std::size_t >()) |
| | default constructor (no ranges)
|
| virtual | ~CachedContingencyCounter () |
| | destructor
|
| void | setNumberOfThreads (Size nb) override |
| | sets the number max of threads that can be used
|
| Size | getNumberOfThreads () const override |
| | returns the current max number of threads of the scheduler
|
| 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
|
| virtual std::size_t | minNbRowsPerThread () const |
| | returns the minimum of rows that each thread should process
|
| void | setRanges (const std::vector< std::pair< std::size_t, std::size_t > > &new_ranges) |
| | sets new ranges to perform the counts
|
| void | clearRanges () |
| | reset the ranges to the one range corresponding to the whole database
|
| const std::vector< std::pair< std::size_t, std::size_t > > & | ranges () const |
| | returns the current ranges
|
| virtual void | clear () |
| | clears all the data structures from memory, including the cache
|
| virtual void | clearCache () |
| | clears the current cache
|
| virtual void | useCache (const bool on_off) |
| | turn on/off the use of a cache of the previously computed score
|
| const Bijection< NodeId, std::size_t > & | nodeId2Columns () const |
| | return the mapping between the columns of the database and the node ids
|
| const DatabaseTable & | database () const |
| | return the database used by the score
|
Common counting infrastructure shared by IndependenceTest and KNML.
Holds the database parser, prior, record counter, and scoring cache. Both IndependenceTest (Chi2, G2) and KNML inherit from this class. Copy and move constructors/operators are protected to prevent slicing.
Definition at line 72 of file cachedContingencyCounter.h.
◆ CachedContingencyCounter() [1/4]
| gum::learning::CachedContingencyCounter::CachedContingencyCounter |
( |
const DBRowGeneratorParser & | parser, |
|
|
const Prior & | prior, |
|
|
const std::vector< std::pair< std::size_t, std::size_t > > & | ranges, |
|
|
const Bijection< NodeId, std::size_t > & | nodeId2columns = Bijection< NodeId, std::size_t >() ) |
default constructor
- Parameters
-
| parser | the parser used to parse the database |
| prior | An prior that we add to the computation of the score |
| ranges | a set of pairs {(X1,Y1),...,(Xn,Yn)} of database's rows indices. The counts are then performed only on the union of the rows [Xi,Yi), i in {1,...,n}. This is useful, e.g, when performing cross validation tasks, in which part of the database should be ignored. An empty set of ranges is equivalent to an interval [X,Y) ranging over the whole database. |
| nodeId2Columns | a mapping from the ids of the nodes in the graphical model to the corresponding column in the DatabaseTable parsed by the parser. An empty bijection means identity mapping. |
References ranges().
Referenced by CachedContingencyCounter(), CachedContingencyCounter(), operator=(), and operator=().
◆ CachedContingencyCounter() [2/4]
default constructor (no ranges)
◆ ~CachedContingencyCounter()
| virtual gum::learning::CachedContingencyCounter::~CachedContingencyCounter |
( |
| ) |
|
|
virtual |
◆ CachedContingencyCounter() [3/4]
| gum::learning::CachedContingencyCounter::CachedContingencyCounter |
( |
const CachedContingencyCounter & | from | ) |
|
|
protected |
◆ CachedContingencyCounter() [4/4]
| gum::learning::CachedContingencyCounter::CachedContingencyCounter |
( |
CachedContingencyCounter && | from | ) |
|
|
protected |
◆ clear()
| virtual void gum::learning::CachedContingencyCounter::clear |
( |
| ) |
|
|
virtual |
clears all the data structures from memory, including the cache
Reimplemented in gum::learning::KNML.
◆ clearCache()
| virtual void gum::learning::CachedContingencyCounter::clearCache |
( |
| ) |
|
|
virtual |
◆ clearRanges()
| void gum::learning::CachedContingencyCounter::clearRanges |
( |
| ) |
|
reset the ranges to the one range corresponding to the whole database
◆ database()
| const DatabaseTable & gum::learning::CachedContingencyCounter::database |
( |
| ) |
const |
return the database used by the score
◆ getNumberOfThreads()
| Size gum::learning::CachedContingencyCounter::getNumberOfThreads |
( |
| ) |
const |
|
overridevirtual |
◆ isGumNumberOfThreadsOverriden()
| bool gum::learning::CachedContingencyCounter::isGumNumberOfThreadsOverriden |
( |
| ) |
const |
|
overridevirtual |
◆ minNbRowsPerThread()
| virtual std::size_t gum::learning::CachedContingencyCounter::minNbRowsPerThread |
( |
| ) |
const |
|
virtual |
returns the minimum of rows that each thread should process
◆ nodeId2Columns()
| const Bijection< NodeId, std::size_t > & gum::learning::CachedContingencyCounter::nodeId2Columns |
( |
| ) |
const |
return the mapping between the columns of the database and the node ids
- Warning
- An empty nodeId2Columns bijection means that the mapping is an identity, i.e., the value of a NodeId is equal to the index of the column in the DatabaseTable.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ ranges()
| const std::vector< std::pair< std::size_t, std::size_t > > & gum::learning::CachedContingencyCounter::ranges |
( |
| ) |
const |
◆ setMinNbRowsPerThread()
| virtual void gum::learning::CachedContingencyCounter::setMinNbRowsPerThread |
( |
const std::size_t | nb | ) |
const |
|
virtual |
changes the number min of rows a thread should process in a multithreading context
◆ setNumberOfThreads()
| void gum::learning::CachedContingencyCounter::setNumberOfThreads |
( |
Size | nb | ) |
|
|
overridevirtual |
◆ setRanges()
| void gum::learning::CachedContingencyCounter::setRanges |
( |
const std::vector< std::pair< std::size_t, std::size_t > > & | new_ranges | ) |
|
sets new ranges to perform the counts
◆ useCache()
| virtual void gum::learning::CachedContingencyCounter::useCache |
( |
const bool | on_off | ) |
|
|
virtual |
turn on/off the use of a cache of the previously computed score
Reimplemented in gum::learning::KNML.
◆ cache_
| ScoringCache gum::learning::CachedContingencyCounter::cache_ |
|
protected |
◆ counter_
◆ empty_ids_
| const std::vector< NodeId > gum::learning::CachedContingencyCounter::empty_ids_ |
|
protected |
◆ one_log2_
| const double gum::learning::CachedContingencyCounter::one_log2_ {M_LOG2E} |
|
protected |
◆ prior_
| Prior* gum::learning::CachedContingencyCounter::prior_ {nullptr} |
|
protected |
◆ use_cache_
| bool gum::learning::CachedContingencyCounter::use_cache_ {true} |
|
protected |
The documentation for this class was generated from the following file: