31 #ifndef GUM_LEARNING_RECORD_COUNTER_H 32 #define GUM_LEARNING_RECORD_COUNTER_H 112 template <
template <
typename >
class ALLOC = std::allocator >
145 const std::vector< std::pair< std::size_t, std::size_t >,
146 ALLOC< std::pair< std::size_t, std::size_t > > >&
280 const std::vector< double, ALLOC< double > >&
290 template <
template <
typename >
class XALLOC >
292 const std::vector< std::pair< std::size_t, std::size_t >,
293 XALLOC< std::pair< std::size_t, std::size_t > > >&
300 const std::vector< std::pair< std::size_t, std::size_t >,
301 ALLOC< std::pair< std::size_t, std::size_t > > >&
308 template <
typename GUM_SCALAR >
327 #ifndef DOXYGEN_SHOULD_SKIP_THIS 331 std::vector< ThreadData< DBRowGeneratorParser< ALLOC > >,
332 ALLOC< ThreadData< DBRowGeneratorParser< ALLOC > > > >
337 std::vector< std::pair< std::size_t, std::size_t >,
338 ALLOC< std::pair< std::size_t, std::size_t > > >
346 mutable std::vector< std::pair< std::size_t, std::size_t >,
347 ALLOC< std::pair< std::size_t, std::size_t > > >
355 std::vector< double, ALLOC< double > > __last_DB_countings;
361 std::vector< double, ALLOC< double > > __last_nonDB_countings;
367 mutable std::size_t __max_nb_threads{
372 mutable std::size_t __min_nb_rows_per_thread{100};
381 std::vector< double, ALLOC< double > >& __extractFromCountings(
384 const std::vector<
double, ALLOC< double > >& superset_vect);
387 std::vector< double, ALLOC< double > >&
391 void __threadedCount(
392 const std::size_t range_begin,
393 const std::size_t range_end,
395 const std::vector< std::pair< std::size_t, std::size_t >,
396 ALLOC< std::pair< std::size_t, std::size_t > > >&
398 std::vector<
double, ALLOC< double > >& countings);
404 template <
template <
typename >
class XALLOC >
406 const std::vector< std::pair< std::size_t, std::size_t >,
407 XALLOC< std::pair< std::size_t, std::size_t > > >&
419 void __raiseCheckException(
420 const std::vector< std::string, ALLOC< std::string > >& bad_vars)
const;
423 void __dispatchRangesToThreads();
Class representing a Bayesian Network.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual RecordCounter< ALLOC > * clone() const
virtual copy constructor
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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