47#ifndef GUM_LEARNING_INDEPENDENCE_TEST_H
48#define GUM_LEARNING_INDEPENDENCE_TEST_H
97 const Prior& external_prior,
98 const std::vector< std::pair< std::size_t, std::size_t > >&
ranges,
119 const Prior& external_prior,
171 void setRanges(
const std::vector< std::pair< std::size_t, std::size_t > >& new_ranges);
177 const std::vector< std::pair< std::size_t, std::size_t > >&
ranges()
const;
259 std::vector< double >
marginalize_(
const std::size_t node_2_marginalize,
260 const std::size_t X_size,
261 const std::size_t Y_size,
262 const std::size_t Z_size,
263 const std::vector< double >& N_xyz)
const;
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.
virtual void setMinNbRowsPerThread(const std::size_t nb) const
changes the number min of rows a thread should process in a multithreading context
IndependenceTest(IndependenceTest &&from)
move constructor
IndependenceTest(const IndependenceTest &from)
copy constructor
virtual void useCache(const bool on_off)
turn on/off the use of a cache of the previously computed score
double score(const NodeId var1, const NodeId var2, const std::vector< NodeId > &rhs_ids)
returns the score of a pair of nodes given some other nodes
IndependenceTest(const DBRowGeneratorParser &parser, const Prior &external_prior, 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
const std::vector< NodeId > empty_ids_
an empty vector
std::vector< 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 > &N_xyz) const
returns a counting vector where variables are marginalized from N_xyz
void setRanges(const std::vector< std::pair< std::size_t, std::size_t > > &new_ranges)
sets new ranges to perform the counts used by the independence test
double score(const NodeId var1, const NodeId var2)
returns the score of a pair of nodes
const double one_log2_
1 / log(2)
virtual std::size_t minNbRowsPerThread() const
returns the minimum of rows that each thread should process
virtual double score_(const IdCondSet &idset)=0
returns the score for a given IdCondSet
RecordCounter counter_
the record counter used for the counts over discrete variables
IndependenceTest & operator=(IndependenceTest &&from)
move operator
IndependenceTest & operator=(const IndependenceTest &from)
copy operator
virtual void clear()
clears all the data structures from memory, including the cache
Prior * prior_
the expert knowledge a priorwe add to the contingency tables
virtual ~IndependenceTest()
destructor
virtual Size getNumberOfThreads() const
returns the current max number of threads of the scheduler
bool use_cache_
a Boolean indicating whether we wish to use the cache
void clearRanges()
reset the ranges to the one range corresponding to the whole database
virtual void clearCache()
clears the current cache
virtual void setNumberOfThreads(Size nb)
sets the number max of threads that can be used
const DatabaseTable & database() const
return the database used by the score
ScoringCache cache_
the scoring cache
const std::vector< std::pair< std::size_t, std::size_t > > & ranges() const
returns the current ranges
virtual IndependenceTest * clone() const =0
virtual copy constructor
virtual bool isGumNumberOfThreadsOverriden() const
indicates whether the user set herself the number of threads
const Bijection< NodeId, std::size_t > & nodeId2Columns() const
return the mapping between the columns of the database and the node ids
IndependenceTest(const DBRowGeneratorParser &parser, const Prior &external_prior, const Bijection< NodeId, std::size_t > &nodeId2columns=Bijection< NodeId, std::size_t >())
default constructor
the base class for all a priori
The class that computes counting of observations from the database.
a cache for caching scores and independence tests results
the classes to account for structure changes in a graph
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
the base class for all the independence tests used for learning
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
the base class for all a priori
The class that computes counting of observations from the database.
a cache for caching scores and independence tests results