aGrUM  0.13.2
gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc > Class Template Reference

This class computes the number of observations of tuples of variables in the database A RecordCounterThread just computes the number of records observed for each value of its target nodes in the database (a target node usually represents either a single Discrete Variable or a pair of Discrete Variables). More...

#include <recordCounter.h>

+ Inheritance diagram for gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >:
+ Collaboration diagram for gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >:

Public Member Functions

Constructors / Destructors
 RecordCounterThread (const RowGeneratorParser &parser, const std::vector< Size > &var_modalities)
 default constructor More...
 
 RecordCounterThread (const RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc > &from)
 copy constructor More...
 
 RecordCounterThread (RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc > &&from)
 move operator More...
 
virtual RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc > * copyFactory () const
 virtual copy constructor More...
 
virtual ~RecordCounterThread ()
 destructor More...
 
Accessors / Modifiers
void count ()
 update all the countings of all the nodesets by parsing the database More...
 
Size DBSize () noexcept
 returns the size of the database More...
 
void setRange (Size min_index, Size max_index)
 sets the interval of records on which countings should be performed More...
 
RowGeneratorParser & parser () noexcept
 returns the generatorParser used for the countings More...
 
Accessors / Modifiers
Idx addNodeSet (const std::vector< Idx, IdSetAlloc > &ids)
 adds a new target nodeset to be counted More...
 
void clearNodeSets () noexcept
 remove all the current target nodesets More...
 
const std::vector< double, CountAlloc > & getCounts (Idx nodeset_id) const noexcept
 returns the countings for the nodeset specified in argument More...
 

Protected Attributes

const std::vector< Size > * _modalities {nullptr}
 the modalities of the variables More...
 
std::vector< const std::vector< Idx, IdSetAlloc > * > _nodesets
 the nodesets whose observations will be counted More...
 
std::vector< std::vector< double, CountAlloc > > _countings
 the nodesets countings More...
 
const char _align [_cache_size] {}
 used to prevent cacheline omp parallel problems More...
 

Static Protected Attributes

static constexpr Size _cache_size {128}
 the size of the cache used to prevent cacheline omp parallel problems More...
 

Detailed Description

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
class gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >

This class computes the number of observations of tuples of variables in the database A RecordCounterThread just computes the number of records observed for each value of its target nodes in the database (a target node usually represents either a single Discrete Variable or a pair of Discrete Variables).

It is not intended to be used as is but rather to be created by class RecordCounter. When the latter has to create several threads to parse the database, it does so by creating RecorCounterThreads.

Definition at line 164 of file recordCounter.h.

Member Typedef Documentation

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
using gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::Base = RecordCounterThreadBase< IdSetAlloc, CountAlloc >
private

Definition at line 166 of file recordCounter.h.

Constructor & Destructor Documentation

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::RecordCounterThread ( const RowGeneratorParser &  parser,
const std::vector< Size > &  var_modalities 
)

default constructor

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::RecordCounterThread ( const RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc > &  from)

copy constructor

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::RecordCounterThread ( RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc > &&  from)

move operator

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::~RecordCounterThread ( )
virtual

destructor

Member Function Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Idx gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::addNodeSet ( const std::vector< Idx, IdSetAlloc > &  ids)
inherited

adds a new target nodeset to be counted

Returns
the id of the nodeset counter created
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::clearNodeSets ( )
noexceptinherited

remove all the current target nodesets

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >* gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::copyFactory ( ) const
virtual
template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::count ( )
virtual

update all the countings of all the nodesets by parsing the database

Implements gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >.

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Size gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::DBSize ( )
virtualnoexcept

returns the size of the database

Implements gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< double, CountAlloc >& gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::getCounts ( Idx  nodeset_id) const
noexceptinherited

returns the countings for the nodeset specified in argument

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
RowGeneratorParser& gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::parser ( )
noexcept

returns the generatorParser used for the countings

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::setRange ( Size  min_index,
Size  max_index 
)
virtual

sets the interval of records on which countings should be performed

Implements gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >.

Member Data Documentation

template<typename RowGeneratorParser, typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
RowGeneratorParser gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >::__parser
private

the DBRowGeneratorParser used to parse the database

Definition at line 227 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const char gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_align[_cache_size] {}
protectedinherited

used to prevent cacheline omp parallel problems

Definition at line 141 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
constexpr Size gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_cache_size {128}
staticprotectedinherited

the size of the cache used to prevent cacheline omp parallel problems

Definition at line 138 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
std::vector< std::vector< double, CountAlloc > > gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_countings
protectedinherited

the nodesets countings

Definition at line 135 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< Size >* gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_modalities {nullptr}
protectedinherited

the modalities of the variables

Definition at line 129 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
std::vector< const std::vector< Idx, IdSetAlloc >* > gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_nodesets
protectedinherited

the nodesets whose observations will be counted

Definition at line 132 of file recordCounter.h.


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