28 #ifndef GUM_LEARNING_INDEPENDENCE_TEST_H 29 #define GUM_LEARNING_INDEPENDENCE_TEST_H 51 template <
template <
typename >
class ALLOC = std::allocator >
88 const std::vector< std::pair< std::size_t, std::size_t >,
89 ALLOC< std::pair< std::size_t, std::size_t > > >&
167 template <
template <
typename >
class XALLOC >
169 const std::vector< std::pair< std::size_t, std::size_t >,
170 XALLOC< std::pair< std::size_t, std::size_t > > >&
177 const std::vector< std::pair< std::size_t, std::size_t >,
178 ALLOC< std::pair< std::size_t, std::size_t > > >&
192 const std::vector<
NodeId, ALLOC< NodeId > >& rhs_ids);
195 virtual void clear();
201 virtual void useCache(
const bool on_off);
275 std::vector< double, ALLOC< double > >
277 const std::size_t X_size,
278 const std::size_t Y_size,
279 const std::size_t Z_size,
280 const std::vector<
double, ALLOC< double > >& N_xyz)
const;
288 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS ScoringCache< ALLOC > _cache
the scoring cache
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The base class for all the independence tests used for learning.
const double _1log2
1 / log(2)
std::vector< double, ALLOC< double > > _marginalize(const std::size_t node_2_marginalize, const std::size_t X_size, const std::size_t Y_size, const std::size_t Z_size, const std::vector< double, ALLOC< double > > &N_xyz) const
returns a counting vector where variables are marginalized from N_xyz
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
RecordCounter< ALLOC > _counter
the record counter used for the countings over discrete variables
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
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
virtual void clearCache()
clears the current cache
const DatabaseTable< ALLOC > & database() const
return the database 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
virtual void setMinNbRowsPerThread(const std::size_t nb) const
changes the number min of rows a thread should process in a multithreading context ...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual double _score(const IdSet< ALLOC > &idset)=0
returns the score for a given IdSet
const std::vector< NodeId, ALLOC< NodeId > > _empty_ids
an empty vector
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
IndependenceTest(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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
allocator_type getAllocator() const
returns the allocator used by the score
The class that computes countings of observations from the database.
void clearRanges()
reset the ranges to the one range corresponding to the whole database
virtual IndependenceTest< ALLOC > * clone() const =0
virtual copy constructor
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void setMaxNbThreads(std::size_t nb) const
changes the max number of threads used to parse the database
IndependenceTest< ALLOC > & operator=(const IndependenceTest< ALLOC > &from)
copy operator
Set of pairs of elements with fast search for both elements.
double score(const NodeId var1, const NodeId var2)
returns the score of a pair of nodes
The class representing a tabular database as used by learning tasks.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual ~IndependenceTest()
destructor
bool _use_cache
a Boolean indicating whether we wish to use the cache
a cache for caching scores and independence tests resultsCaching previously computed scores or the re...
virtual void useCache(const bool on_off)
turn on/off the use of a cache of the previously computed score
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
virtual std::size_t nbThreads() const
returns the number of threads used to parse the database
Size NodeId
Type for node ids.
virtual void clear()
clears all the data structures from memory, including the cache
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 independence test
Apriori< ALLOC > * _apriori
the expert knowledge a priori we add to the contongency tables