28 #ifndef GUM_LEARNING_RECORD_COUNTER_H 29 #define GUM_LEARNING_RECORD_COUNTER_H 109 template <
template <
typename >
class ALLOC = std::allocator >
142 const std::vector< std::pair< std::size_t, std::size_t >,
143 ALLOC< std::pair< std::size_t, std::size_t > > >&
277 const std::vector< double, ALLOC< double > >&
287 template <
template <
typename >
class XALLOC >
289 const std::vector< std::pair< std::size_t, std::size_t >,
290 XALLOC< std::pair< std::size_t, std::size_t > > >&
297 const std::vector< std::pair< std::size_t, std::size_t >,
298 ALLOC< std::pair< std::size_t, std::size_t > > >&
305 template <
typename GUM_SCALAR >
324 #ifndef DOXYGEN_SHOULD_SKIP_THIS 328 std::vector< ThreadData< DBRowGeneratorParser< ALLOC > >,
329 ALLOC< ThreadData< DBRowGeneratorParser< ALLOC > > > >
334 std::vector< std::pair< std::size_t, std::size_t >,
335 ALLOC< std::pair< std::size_t, std::size_t > > >
343 mutable std::vector< std::pair< std::size_t, std::size_t >,
344 ALLOC< std::pair< std::size_t, std::size_t > > >
352 std::vector< double, ALLOC< double > > __last_DB_countings;
358 std::vector< double, ALLOC< double > > __last_nonDB_countings;
364 mutable std::size_t __max_nb_threads{
369 mutable std::size_t __min_nb_rows_per_thread{100};
378 std::vector< double, ALLOC< double > >& __extractFromCountings(
381 const std::vector<
double, ALLOC< double > >& superset_vect);
384 std::vector< double, ALLOC< double > >&
388 void __threadedCount(
389 const std::size_t range_begin,
390 const std::size_t range_end,
392 const std::vector< std::pair< std::size_t, std::size_t >,
393 ALLOC< std::pair< std::size_t, std::size_t > > >&
395 std::vector<
double, ALLOC< double > >& countings);
401 template <
template <
typename >
class XALLOC >
403 const std::vector< std::pair< std::size_t, std::size_t >,
404 XALLOC< std::pair< std::size_t, std::size_t > > >&
416 void __raiseCheckException(
417 const std::vector< std::string, ALLOC< std::string > >& bad_vars)
const;
420 void __dispatchRangesToThreads();
Class representing a Bayesian Network.
A wrapper that enables to store data in a way that prevents false cacheline sharing.
virtual RecordCounter< ALLOC > * clone() const
virtual copy constructor
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > & nodeId2Columns() const
returns the mapping from ids to column positions in the database
void clearRanges()
reset the ranges to the one range corresponding to the whole database
std::size_t nbThreads() const
returns the number of threads used to parse the database
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set...
allocator_type getAllocator() const
returns the allocator used
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
A class used by learning caches to represent uniquely sets of variables.
gum is the global namespace for all aGrUM entities
void setMaxNbThreads(const std::size_t nb) const
changes the max number of threads used to parse the database
The class for generic Hash Tables.
const std::vector< std::pair< std::size_t, std::size_t >, ALLOC< std::pair< std::size_t, std::size_t > > > & ranges() const
returns the current ranges
void clear()
clears all the last database-parsed countings from memory
std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
The class that computes countings of observations from the database.
const std::vector< double, ALLOC< double > > & counts(const IdSet< ALLOC > &ids, const bool check_discrete_vars=false)
returns the counts over all the variables in an IdSet
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
The class that computes countings of observations from the database.
void setMinNbRowsPerThread(const std::size_t nb) const
changes the number min of rows a thread should process in a multithreading context ...
Set of pairs of elements with fast search for both elements.
The class representing a tabular database as used by learning tasks.
virtual ~RecordCounter()
destructor
void setRanges(const std::vector< std::pair< std::size_t, std::size_t >, XALLOC< std::pair< std::size_t, std::size_t > > > &new_ranges)
sets new ranges to perform the countings
RecordCounter< ALLOC > & operator=(const RecordCounter< ALLOC > &from)
copy operator
The class for parsing DatabaseTable rows and generating output rows.
RecordCounter(const DBRowGeneratorParser< ALLOC > &parser, const std::vector< std::pair< std::size_t, std::size_t >, ALLOC< std::pair< std::size_t, std::size_t > > > &ranges, const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > &nodeId2columns=Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(), const allocator_type &alloc=allocator_type())
default constructor
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
Size NodeId
Type for node ids.
Set of pairs of elements with fast search for both elements.
Base classes for directed acyclic graphs.
void setBayesNet(const BayesNet< GUM_SCALAR > &new_bn)
assign a new Bayes net to all the counter's generators depending on a BN
const DatabaseTable< ALLOC > & database() const
returns the database on which we perform the counts