![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
A DBRowGenerator class that returns incomplete rows as EM would do. More...
#include <agrum/base/database/DBRowGeneratorEM.h>
Public Member Functions | |
Constructors / Destructors | |
| DBRowGeneratorEM (const std::vector< DBTranslatedValueType > &column_types, const BayesNet< GUM_SCALAR > &bn, const Bijection< NodeId, std::size_t > &nodeId2columns=Bijection< NodeId, std::size_t >()) | |
| default constructor | |
| DBRowGeneratorEM (const DBRowGeneratorEM< GUM_SCALAR > &from) | |
| copy constructor | |
| DBRowGeneratorEM (DBRowGeneratorEM< GUM_SCALAR > &&from) | |
| move constructor | |
| DBRowGeneratorEM< GUM_SCALAR > * | clone () const final |
| virtual copy constructor | |
| ~DBRowGeneratorEM () | |
| destructor | |
Operators | |
| DBRowGeneratorEM< GUM_SCALAR > & | operator= (const DBRowGeneratorEM< GUM_SCALAR > &from) |
| copy operator | |
| DBRowGeneratorEM< GUM_SCALAR > & | operator= (DBRowGeneratorEM< GUM_SCALAR > &&from) |
| move operator | |
Accessors / Modifiers | |
| virtual const DBRow< DBTranslatedValue > & | generate () override final |
| generates one ouput DBRow for each DBRow passed to method setInputRow | |
| virtual void | setBayesNet (const BayesNet< GUM_SCALAR > &new_bn) override final |
| assign a new Bayes net to the generator | |
Accessors / Modifiers | |
| virtual void | setBayesNet (const BayesNet< double > &new_bn) |
| assign a new Bayes net to the generator | |
| const BayesNet< double > & | getBayesNet () const |
| returns the Bayes net used by the generator | |
Accessors / Modifiers | |
| bool | hasRows () |
| returns true if there are still rows that can be output by the DBRowGenerator | |
| bool | setInputRow (const DBRow< DBTranslatedValue > &row) |
| sets the input row from which the generator will create its output rows | |
| void | decreaseRemainingRows () |
| decrease the number of remaining output rows | |
| virtual void | reset () |
| resets the generator. There are therefore no more ouput row to generate | |
| virtual void | setColumnsOfInterest (const std::vector< std::size_t > &cols_of_interest) |
| sets the columns of interest: the output DBRow needs only contain correct values fot these columns | |
| virtual void | setColumnsOfInterest (std::vector< std::size_t > &&cols_of_interest) |
| sets the columns of interest: the output DBRow needs only contain correct values fot these columns | |
| const std::vector< std::size_t > & | columnsOfInterest () const |
| returns the current set of columns of interest | |
| DBRowGeneratorGoal | goal () const |
| returns the goal of the DBRowGenerator | |
Protected Member Functions | |
| virtual std::size_t | computeRows_ (const DBRow< DBTranslatedValue > &row) override final |
| computes the rows it will provide as output | |
Protected Attributes | |
| const BayesNet< double > * | bn_ |
| the Bayesian network used to fill the unobserved values | |
| Bijection< NodeId, std::size_t > | nodeId2columns_ |
| the mapping betwen the BN's node ids and the database's columns | |
| std::size_t | nb_remaining_output_rows_ {std::size_t(0)} |
| the number of output rows still to retrieve through the generate method | |
| std::vector< DBTranslatedValueType > | column_types_ |
| the types of the columns in the DatabaseTable | |
| std::vector< std::size_t > | columns_of_interest_ |
| the set of columns of interest | |
| DBRowGeneratorGoal | goal_ {DBRowGeneratorGoal::OTHER_THINGS_THAN_REMOVE_MISSING_VALUES} |
| the goal of the DBRowGenerator (just remove missing values or not) | |
A DBRowGenerator class that returns incomplete rows as EM would do.
This class is a DBRowGenerator that fills the unobserved values of the nodes of interest as the EM algorithm does, i.e., by returning all the possible completed rows with a weight corresponding to the probability of the completion. The standard usage of a DBRowGenerator is the following:
Definition at line 97 of file DBRowGeneratorEM.h.
| gum::learning::DBRowGeneratorEM< GUM_SCALAR >::DBRowGeneratorEM | ( | const std::vector< DBTranslatedValueType > & | column_types, |
| const BayesNet< GUM_SCALAR > & | bn, | ||
| const Bijection< NodeId, std::size_t > & | nodeId2columns = Bijection< NodeId, std::size_t >() ) |
default constructor
Referenced by DBRowGeneratorEM(), DBRowGeneratorEM(), ~DBRowGeneratorEM(), clone(), operator=(), and operator=().
| gum::learning::DBRowGeneratorEM< GUM_SCALAR >::DBRowGeneratorEM | ( | const DBRowGeneratorEM< GUM_SCALAR > & | from | ) |
| gum::learning::DBRowGeneratorEM< GUM_SCALAR >::DBRowGeneratorEM | ( | DBRowGeneratorEM< GUM_SCALAR > && | from | ) |
| gum::learning::DBRowGeneratorEM< GUM_SCALAR >::~DBRowGeneratorEM | ( | ) |
|
finalvirtual |
virtual copy constructor
Implements gum::learning::DBRowGenerator.
References DBRowGeneratorEM().
|
inherited |
returns the current set of columns of interest
|
finaloverrideprotectedvirtual |
computes the rows it will provide as output
Implements gum::learning::DBRowGenerator.
References computeRows_().
Referenced by computeRows_().
|
inherited |
decrease the number of remaining output rows
When method setInputRow is performed, the DBRowGenerator knows how many output rows it will be able to generate. Each time method decreaseRemainingRows is called, we decrement this number. When the number becomes equal to 0, then there remains no new output row to generate.
|
finaloverridevirtual |
generates one ouput DBRow for each DBRow passed to method setInputRow
Implements gum::learning::DBRowGenerator.
References generate().
Referenced by generate().
|
inherited |
returns the Bayes net used by the generator
|
inherited |
returns the goal of the DBRowGenerator
Referenced by DBRowGenerator(), and gum::learning::DBRowGeneratorWithBN< GUM_SCALAR >::DBRowGeneratorWithBN().
|
inherited |
returns true if there are still rows that can be output by the DBRowGenerator
| DBRowGeneratorEM< GUM_SCALAR > & gum::learning::DBRowGeneratorEM< GUM_SCALAR >::operator= | ( | const DBRowGeneratorEM< GUM_SCALAR > & | from | ) |
| DBRowGeneratorEM< GUM_SCALAR > & gum::learning::DBRowGeneratorEM< GUM_SCALAR >::operator= | ( | DBRowGeneratorEM< GUM_SCALAR > && | from | ) |
|
virtualinherited |
resets the generator. There are therefore no more ouput row to generate
|
finaloverridevirtual |
assign a new Bayes net to the generator
References setBayesNet().
Referenced by setBayesNet().
|
virtualinherited |
assign a new Bayes net to the generator
|
virtualinherited |
sets the columns of interest: the output DBRow needs only contain correct values fot these columns
This method is useful, e.g., for EM-like algorithms that need to know which unobserved variables/values need be filled. In this case, the DBRowGenerator still outputs DBRows with the same columns as the DatabaseTable, but only the columns of these DBRows corresponding to those passed in argument to Method setColumnsOfInterest are meaningful. For instance, if a DatabaseTable contains 10 columns and Method setColumnsOfInterest() is applied with vector<> { 0, 3, 4 }, then the DBRowGenerator will output DBRows with 10 columns, in which only columns 0, 3 and 4 are guaranteed to have correct values (columns are always indexed, starting from 0).
|
virtualinherited |
sets the columns of interest: the output DBRow needs only contain correct values fot these columns
This method is useful, e.g., for EM-like algorithms that need to know which unobserved variables/values need be filled. In this case, the DBRowGenerator still outputs DBRows with the same columns as the DatabaseTable, but only the columns of these DBRows corresponding to those passed in argument to Method setColumnsOfInterest are meaningful. For instance, if a DatabaseTable contains 10 columns and Method setColumnsOfInterest() is applied with vector<> { 0, 3, 4 }, then the DBRowGenerator will output DBRows with 10 columns, in which only columns 0, 3 and 4 are guaranteed to have correct values (columns are always indexed, starting from 0).
|
inherited |
sets the input row from which the generator will create its output rows
|
protectedinherited |
the Bayesian network used to fill the unobserved values
Definition at line 144 of file DBRowGeneratorWithBN.h.
|
protectedinherited |
the types of the columns in the DatabaseTable
This is useful to determine whether we need to use the .discr_val field or the .cont_val field in DBTranslatedValue instances.
Definition at line 330 of file DBRowGenerator.h.
|
protectedinherited |
the set of columns of interest
Definition at line 333 of file DBRowGenerator.h.
|
protectedinherited |
the goal of the DBRowGenerator (just remove missing values or not)
Definition at line 336 of file DBRowGenerator.h.
|
protectedinherited |
the number of output rows still to retrieve through the generate method
Definition at line 325 of file DBRowGenerator.h.
|
protectedinherited |
the mapping betwen the BN's node ids and the database's columns
Definition at line 147 of file DBRowGeneratorWithBN.h.