47#ifndef GUM_LEARNING_INDEPENDENCE_TEST_H
48#define GUM_LEARNING_INDEPENDENCE_TEST_H
90 const Prior& external_prior,
91 const std::vector< std::pair< std::size_t, std::size_t > >&
ranges,
112 const Prior& external_prior,
126 virtual std::pair< double, double >
161 std::size_t Z_size = 1,
162 std::size_t n_skipped = 0);
174 std::vector< double >
marginalize_(
const std::size_t node_2_marginalize,
175 const std::size_t X_size,
176 const std::size_t Y_size,
177 const std::size_t Z_size,
178 const std::vector< double >& N_xyz)
const;
185 template <
typename CellContribFn >
187 CellContribFn cellContrib);
Common counting infrastructure for independence tests and KNML scoring.
const std::vector< std::pair< std::size_t, std::size_t > > & ranges() const
returns the current ranges
CachedContingencyCounter(const DBRowGeneratorParser &parser, const Prior &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
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set.
virtual std::pair< double, double > statistics(NodeId var1, NodeId var2, const std::vector< NodeId > &rhs_ids={})=0
returns the pair (test statistic, p-value) for the independence test X _|_ Y | Z
IndependenceTest(IndependenceTest &&from)
move constructor
IndependenceTest(const IndependenceTest &from)
copy constructor
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
std::vector< std::size_t > _domain_sizes_
the domain sizes of the variables (indexed by column id in the database)
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
IndependenceTest & operator=(IndependenceTest &&from)
move operator
IndependenceTest & operator=(const IndependenceTest &from)
copy operator
std::pair< double, double > computeStatistics_(const IdCondSet &idset, CellContribFn cellContrib)
shared loop for chi-squared-family statistics
static Size degreesOfFreedom_(std::size_t X_size, std::size_t Y_size, std::size_t Z_size=1, std::size_t n_skipped=0)
returns the degrees of freedom for a chi2/G2 test X _|_ Y | Z
~IndependenceTest() override
destructor
virtual IndependenceTest * clone() const =0
virtual copy constructor
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
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
template implementation of computeStatistics_(), shared by all chi-squared-family independence tests ...
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities