27 #ifndef GUM_LEARNING_DBROW_GENERATOR_EM_H 28 #define GUM_LEARNING_DBROW_GENERATOR_EM_H 32 #include <agrum/agrum.h> 33 #include <agrum/tools/core/bijection.h> 34 #include <agrum/BN/BayesNet.h> 35 #include <agrum/BN/inference/variableElimination.h> 36 #include <agrum/tools/database/DBRowGeneratorWithBN.h> 78 template <
typename GUM_SCALAR =
double,
template <
typename >
class ALLOC = std::allocator >
103 const allocator_type& alloc);
109 DBRowGeneratorEM(DBRowGeneratorEM< GUM_SCALAR, ALLOC >&& from,
const allocator_type& alloc);
151 virtual void setBayesNet(
const BayesNet< GUM_SCALAR >& new_bn)
override final;
161 virtual std::size_t
computeRows_(
const DBRow< DBTranslatedValue, ALLOC >& row)
override final;
164 #ifndef DOXYGEN_SHOULD_SKIP_THIS 168 const DBRow< DBTranslatedValue, ALLOC >* _input_row_{
nullptr};
171 std::vector< std::size_t, ALLOC< std::size_t > > _missing_cols_;
174 std::size_t _nb_miss_;
177 Potential< GUM_SCALAR > _joint_proba_;
180 Instantiation* _joint_inst_{
nullptr};
189 DBRow< DBTranslatedValue, ALLOC > _filled_row1_;
192 DBRow< DBTranslatedValue, ALLOC > _filled_row2_;
195 bool _use_filled_row1_{
true};
198 double _original_weight_;
210 #include <agrum/tools/database/DBRowGeneratorEM_tpl.h> virtual DBRowGeneratorEM< GUM_SCALAR, ALLOC > * clone(const allocator_type &alloc) const override final
virtual copy constructor with a given allocator
DBRowGeneratorEM(const DBRowGeneratorEM< GUM_SCALAR, ALLOC > &from)
copy constructor
DBRowGeneratorEM(DBRowGeneratorEM< GUM_SCALAR, ALLOC > &&from)
move constructor
INLINE void emplace(Args &&... args)
DBRowGeneratorEM(const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const BayesNet< GUM_SCALAR > &bn, 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
A DBRowGenerator class that returns incomplete rows as EM would do.
DBRowGeneratorEM< GUM_SCALAR, ALLOC > & operator=(DBRowGeneratorEM< GUM_SCALAR, ALLOC > &&from)
move operator
DBRowGeneratorEM(DBRowGeneratorEM< GUM_SCALAR, ALLOC > &&from, const allocator_type &alloc)
move constructor with a given allocator
virtual DBRowGeneratorEM< GUM_SCALAR, ALLOC > * clone() const override final
virtual copy constructor
DBRowGeneratorEM(const DBRowGeneratorEM< GUM_SCALAR, ALLOC > &from, const allocator_type &alloc)
copy constructor with a given allocator
~DBRowGeneratorEM()
destructor
virtual void setBayesNet(const BayesNet< GUM_SCALAR > &new_bn) override final
assign a new Bayes net to the generator
virtual std::size_t computeRows_(const DBRow< DBTranslatedValue, ALLOC > &row) override final
computes the rows it will provide as output
virtual const DBRow< DBTranslatedValue, ALLOC > & generate() override final
generates one ouput DBRow for each DBRow passed to method setInputRow
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
DBRowGeneratorEM< GUM_SCALAR, ALLOC > & operator=(const DBRowGeneratorEM< GUM_SCALAR, ALLOC > &from)
copy operator
allocator_type getAllocator() const
returns the allocator used