50#ifndef GUM_LEARNING_RECORD_COUNTER_H
51#define GUM_LEARNING_RECORD_COUNTER_H
153 const std::vector< std::pair< std::size_t, std::size_t > >&
ranges,
272 const bool check_discrete_vars =
false);
281 void setRanges(
const std::vector< std::pair< std::size_t, std::size_t > >& new_ranges);
287 const std::vector< std::pair< std::size_t, std::size_t > >&
ranges()
const;
293 template <
typename GUM_SCALAR >
307#ifndef DOXYGEN_SHOULD_SKIP_THIS
311 std::vector< ThreadData< DBRowGeneratorParser > > _parsers_;
315 std::vector< std::pair< std::size_t, std::size_t > > _ranges_;
322 mutable std::vector< std::pair< std::size_t, std::size_t > > _thread_ranges_;
329 std::vector< double > _last_DB_counting_;
335 std::vector< double > _last_nonDB_counting_;
342 mutable std::size_t _min_nb_rows_per_thread_{512};
350 std::vector< double >& _extractFromCountings_(
const IdCondSet& subset_ids,
352 const std::vector< double >& superset_vect);
355 std::vector< double >& _countFromDatabase_(
const IdCondSet& ids);
362 const std::vector< std::pair< std::size_t, std::size_t > >& new_ranges)
const;
367 void _checkDiscreteVariables_(
const IdCondSet& ids)
const;
373 void _raiseCheckException_(
const std::vector< std::string >& bad_vars)
const;
376 void _dispatchRangesToThreads_();
The class for parsing DatabaseTable rows and generating output rows.
The class for generic Hash Tables.
ThreadNumberManager(Size nb_threads=0)
default constructor
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
The class representing a tabular database as used by learning tasks.
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set.
RecordCounter & operator=(RecordCounter &&from)
move operator
RecordCounter(const RecordCounter &from)
copy constructor
std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
RecordCounter(const DBRowGeneratorParser &parser, 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
RecordCounter & operator=(const RecordCounter &from)
copy operator
const std::vector< std::pair< std::size_t, std::size_t > > & ranges() const
returns the current ranges
void setRanges(const std::vector< std::pair< std::size_t, std::size_t > > &new_ranges)
sets new ranges to perform the counting
virtual void setNumberOfThreads(Size nb)
sets the number max of threads that can be used
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 & database() const
returns the database on which we perform the counts
void clear()
clears all the last database-parsed counting from memory
virtual RecordCounter * clone() const
virtual copy constructor
RecordCounter(RecordCounter &&from)
move constructor
void clearRanges()
reset the ranges to the one range corresponding to the whole database
const Bijection< NodeId, std::size_t > & nodeId2Columns() const
returns the mapping from ids to column positions in the database
RecordCounter(const DBRowGeneratorParser &parser, const Bijection< NodeId, std::size_t > &nodeId2columns=Bijection< NodeId, std::size_t >())
default constructor
const std::vector< double > & counts(const IdCondSet &ids, const bool check_discrete_vars=false)
returns the counts over all the variables in an IdCondSet
void setMinNbRowsPerThread(const std::size_t nb) const
changes the number min of rows a thread should process in a multithreading context
virtual ~RecordCounter()
destructor
std::size_t Size
In aGrUM, hashed values are unsigned long int.
A class used by learning caches to represent uniquely sets of variables.
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
The class that computes counts of observations from the database.
A wrapper that enables to store data in a way that prevents false cacheline sharing.