![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A DBRowGenerator class that returns the rows that are complete (fully observed) w.r.t. More...
#include <agrum/tools/database/DBRowGenerator4CompleteRows.h>
Public Member Functions | |
Constructors / Destructors | |
DBRowGenerator4CompleteRows (const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const allocator_type &alloc=allocator_type()) | |
default constructor More... | |
DBRowGenerator4CompleteRows (const DBRowGenerator4CompleteRows< ALLOC > &from) | |
copy constructor More... | |
DBRowGenerator4CompleteRows (const DBRowGenerator4CompleteRows< ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
DBRowGenerator4CompleteRows (DBRowGenerator4CompleteRows< ALLOC > &&from) | |
move constructor More... | |
DBRowGenerator4CompleteRows (DBRowGenerator4CompleteRows< ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
virtual DBRowGenerator4CompleteRows< ALLOC > * | clone () const override final |
virtual copy constructor More... | |
virtual DBRowGenerator4CompleteRows< ALLOC > * | clone (const allocator_type &alloc) const override final |
virtual copy constructor with a given allocator More... | |
~DBRowGenerator4CompleteRows () | |
destructor More... | |
Operators | |
DBRowGenerator4CompleteRows< ALLOC > & | operator= (const DBRowGenerator4CompleteRows< ALLOC > &from) |
copy operator More... | |
DBRowGenerator4CompleteRows< ALLOC > & | operator= (DBRowGenerator4CompleteRows< ALLOC > &&from) |
move operator More... | |
Accessors / Modifiers | |
virtual const DBRow< DBTranslatedValue, ALLOC > & | generate () final |
generates one ouput DBRow for each DBRow passed to method setInputRow More... | |
allocator_type | getAllocator () const |
returns the allocator used More... | |
Accessors / Modifiers | |
bool | hasRows () |
returns true if there are still rows that can be output by the DBRowGenerator More... | |
bool | setInputRow (const DBRow< DBTranslatedValue, ALLOC > &row) |
sets the input row from which the generator will create its output rows More... | |
void | decreaseRemainingRows () |
decrease the number of remaining output rows More... | |
virtual void | reset () |
resets the generator. There are therefore no more ouput row to generate More... | |
virtual void | setColumnsOfInterest (const std::vector< std::size_t, ALLOC< std::size_t > > &cols_of_interest) |
sets the columns of interest: the output DBRow needs only contain correct values fot these columns More... | |
virtual void | setColumnsOfInterest (std::vector< std::size_t, ALLOC< std::size_t > > &&cols_of_interest) |
sets the columns of interest: the output DBRow needs only contain correct values fot these columns More... | |
const std::vector< std::size_t, ALLOC< std::size_t > > & | columnsOfInterest () const |
returns the current set of columns of interest More... | |
DBRowGeneratorGoal | goal () const |
returns the goal of the DBRowGenerator More... | |
Public Types | |
using | allocator_type = ALLOC< DBTranslatedValue > |
type for the allocators passed in arguments of methods More... | |
Protected Attributes | |
std::size_t | nb_remaining_output_rows_ {std::size_t(0)} |
the number of output rows still to retrieve through the generate method More... | |
std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > | column_types_ |
the types of the columns in the DatabaseTable More... | |
std::vector< std::size_t, ALLOC< std::size_t > > | columns_of_interest_ |
the set of columns of interest More... | |
DBRowGeneratorGoal | goal_ {DBRowGeneratorGoal::OTHER_THINGS_THAN_REMOVE_MISSING_VALUES} |
the goal of the DBRowGenerator (just remove missing values or not) More... | |
Protected Member Functions | |
virtual std::size_t | computeRows_ (const DBRow< DBTranslatedValue, ALLOC > &row) final |
computes the rows it will provide as output More... | |
A DBRowGenerator class that returns the rows that are complete (fully observed) w.r.t.
the nodes of interest
This class is a DBRowGenerator that returns all the rows that are complete (i.e., fully observed) w.r.t. the nodes of interest. In other words, whenever the values of the nodes of interest are observed in a row, this one is returned, but if at least one node is unobserved, the generator does not return anything. This class is useful for bootstraping EM algorithms.
The standard usage of a DBRowGenerator is the following:
Definition at line 79 of file DBRowGenerator4CompleteRows.h.
using gum::learning::DBRowGenerator4CompleteRows< ALLOC >::allocator_type = ALLOC< DBTranslatedValue > |
type for the allocators passed in arguments of methods
Definition at line 82 of file DBRowGenerator4CompleteRows.h.
gum::learning::DBRowGenerator4CompleteRows< ALLOC >::DBRowGenerator4CompleteRows | ( | const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > | column_types, |
const allocator_type & | alloc = allocator_type() |
||
) |
default constructor
gum::learning::DBRowGenerator4CompleteRows< ALLOC >::DBRowGenerator4CompleteRows | ( | const DBRowGenerator4CompleteRows< ALLOC > & | from | ) |
copy constructor
gum::learning::DBRowGenerator4CompleteRows< ALLOC >::DBRowGenerator4CompleteRows | ( | const DBRowGenerator4CompleteRows< ALLOC > & | from, |
const allocator_type & | alloc | ||
) |
copy constructor with a given allocator
gum::learning::DBRowGenerator4CompleteRows< ALLOC >::DBRowGenerator4CompleteRows | ( | DBRowGenerator4CompleteRows< ALLOC > && | from | ) |
move constructor
gum::learning::DBRowGenerator4CompleteRows< ALLOC >::DBRowGenerator4CompleteRows | ( | DBRowGenerator4CompleteRows< ALLOC > && | from, |
const allocator_type & | alloc | ||
) |
move constructor with a given allocator
gum::learning::DBRowGenerator4CompleteRows< ALLOC >::~DBRowGenerator4CompleteRows | ( | ) |
destructor
|
finaloverridevirtual |
virtual copy constructor
Implements gum::learning::DBRowGenerator< ALLOC >.
|
finaloverridevirtual |
virtual copy constructor with a given allocator
Implements gum::learning::DBRowGenerator< ALLOC >.
|
inherited |
returns the current set of columns of interest
|
finalprotectedvirtual |
computes the rows it will provide as output
Implements gum::learning::DBRowGenerator< ALLOC >.
|
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.
|
finalvirtual |
generates one ouput DBRow for each DBRow passed to method setInputRow
Implements gum::learning::DBRowGenerator< ALLOC >.
allocator_type gum::learning::DBRowGenerator4CompleteRows< ALLOC >::getAllocator | ( | ) | const |
returns the allocator used
|
inherited |
returns the goal of the DBRowGenerator
|
inherited |
returns true if there are still rows that can be output by the DBRowGenerator
DBRowGenerator4CompleteRows< ALLOC >& gum::learning::DBRowGenerator4CompleteRows< ALLOC >::operator= | ( | const DBRowGenerator4CompleteRows< ALLOC > & | from | ) |
copy operator
DBRowGenerator4CompleteRows< ALLOC >& gum::learning::DBRowGenerator4CompleteRows< ALLOC >::operator= | ( | DBRowGenerator4CompleteRows< ALLOC > && | from | ) |
move operator
|
virtualinherited |
resets the generator. There are therefore no more ouput row to generate
|
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 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 361 of file DBRowGenerator.h.
|
protectedinherited |
the set of columns of interest
Definition at line 364 of file DBRowGenerator.h.
|
protectedinherited |
the goal of the DBRowGenerator (just remove missing values or not)
Definition at line 367 of file DBRowGenerator.h.
|
protectedinherited |
the number of output rows still to retrieve through the generate method
Definition at line 356 of file DBRowGenerator.h.