28 #ifndef GUM_LEARNING_SCORE_H 29 #define GUM_LEARNING_SCORE_H 51 template <
template <
typename >
class ALLOC = std::allocator >
86 const std::vector< std::pair< std::size_t, std::size_t >,
87 ALLOC< std::pair< std::size_t, std::size_t > > >&
162 template <
template <
typename >
class XALLOC >
164 const std::vector< std::pair< std::size_t, std::size_t >,
165 XALLOC< std::pair< std::size_t, std::size_t > > >&
172 const std::vector< std::pair< std::size_t, std::size_t >,
173 ALLOC< std::pair< std::size_t, std::size_t > > >&
184 const std::vector<
NodeId, ALLOC< NodeId > >& rhs_ids);
286 std::vector< double, ALLOC< double > >
288 const std::vector<
double, ALLOC< double > >& N_xyz)
const;
296 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const DatabaseTable< ALLOC > & database() const
return the database used by the score
double score(const NodeId var)
returns the score of a single node
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 used by the score
const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > & nodeId2Columns() const
return the mapping between the columns of the database and the node ids
The base class for all the scores used for learning (BIC, BDeu, etc)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Score(const DBRowGeneratorParser< ALLOC > &parser, const Apriori< ALLOC > &external_apriori, 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
virtual void setMaxNbThreads(std::size_t nb) const
changes the max number of threads used to parse the database
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const double _1log2
1 / log(2)
virtual std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set...
the base class for all a priori
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.
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
ScoringCache< ALLOC > _cache
the scoring cache
const std::vector< NodeId, ALLOC< NodeId > > _empty_ids
an empty vector
std::vector< double, ALLOC< double > > _marginalize(const NodeId X_id, const std::vector< double, ALLOC< double > > &N_xyz) const
returns a counting vector where variables are marginalized from N_xyz
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual std::size_t nbThreads() const
returns the number of threads used to parse the database
The class that computes countings of observations from the database.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual ~Score()
destructor
Score< ALLOC > & operator=(const Score< ALLOC > &from)
copy operator
void clear()
clears all the data structures from memory, including the cache
Set of pairs of elements with fast search for both elements.
virtual const Apriori< ALLOC > & internalApriori() const =0
returns the internal apriori of the score
virtual double _score(const IdSet< ALLOC > &idset)=0
returns the score for a given IdSet
The class representing a tabular database as used by learning tasks.
bool isUsingCache() const
indicates whether the score uses a cache
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void clearCache()
clears the current cache
a cache for caching scores and independence tests resultsCaching previously computed scores or the re...
virtual std::string isAprioriCompatible() const =0
indicates whether the apriori is compatible (meaningful) with the score
void useCache(const bool on_off)
turn on/off the use of a cache of the previously computed score
void clearRanges()
reset the ranges to the one range corresponding to the whole database
allocator_type getAllocator() const
returns the allocator used by the score
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool _use_cache
a Boolean indicating whether we wish to use the cache
virtual void setMinNbRowsPerThread(const std::size_t nb) const
changes the number min of rows a thread should process in a multithreading context ...
Apriori< ALLOC > * _apriori
the expert knowledge a priori we add to the score
RecordCounter< ALLOC > _counter
the record counter used for the countings over discrete variables
virtual Score< ALLOC > * clone() const =0
virtual copy 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.