25 #ifndef GUM_LEARNING_INDEPENDENCE_TEST_H 26 #define GUM_LEARNING_INDEPENDENCE_TEST_H 48 template <
template <
typename >
class ALLOC = std::allocator >
85 const std::vector< std::pair< std::size_t, std::size_t >,
86 ALLOC< std::pair< std::size_t, std::size_t > > >&
164 template <
template <
typename >
class XALLOC >
166 const std::vector< std::pair< std::size_t, std::size_t >,
167 XALLOC< std::pair< std::size_t, std::size_t > > >&
174 const std::vector< std::pair< std::size_t, std::size_t >,
175 ALLOC< std::pair< std::size_t, std::size_t > > >&
189 const std::vector<
NodeId, ALLOC< NodeId > >& rhs_ids);
192 virtual void clear();
198 virtual void useCache(
const bool on_off);
272 std::vector< double, ALLOC< double > >
274 const std::size_t X_size,
275 const std::size_t Y_size,
276 const std::size_t Z_size,
277 const std::vector<
double, ALLOC< double > >& N_xyz)
const;
285 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS ScoringCache< ALLOC > _cache
the scoring cache
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
the classes to account for structure changes in a graph
virtual std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
the base class for all a priori
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 ...
gum is the global namespace for all aGrUM entities
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
the base class for all the independence tests used for learning
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
The class that computes countings of observations from the database.
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
a cache for caching scores and independence tests results
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.
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