libDAI
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
dai::Evidence Class Reference

Stores a data set consisting of multiple samples, where each sample is the observed joint state of some variables. More...

#include <dai/evidence.h>

Public Types

typedef std::map< Var, size_t > Observation
 Stores joint state of a set of variables. More...
 

Public Member Functions

 Evidence ()
 Default constructor. More...
 
 Evidence (std::vector< Observation > &samples)
 Construct from samples. More...
 
void addEvidenceTabFile (std::istream &is, FactorGraph &fg)
 Read in tabular data from a stream and add the read samples to *this. More...
 
size_t nrSamples () const
 Returns number of stored samples. More...
 

Private Member Functions

void addEvidenceTabFile (std::istream &is, std::map< std::string, Var > &varMap)
 Read in tabular data from a stream and add the read samples to *this. More...
 

Private Attributes

std::vector< Observation_samples
 Each sample is an observed joint state of some variables. More...
 

Iterator interface

typedef std::vector< Observation >::iterator iterator
 Iterator over the samples. More...
 
typedef std::vector< Observation >::const_iterator const_iterator
 Constant iterator over the samples. More...
 
iterator begin ()
 Returns iterator that points to the first sample. More...
 
const_iterator begin () const
 Returns constant iterator that points to the first sample. More...
 
iterator end ()
 Returns iterator that points beyond the last sample. More...
 
const_iterator end () const
 Returns constant iterator that points beyond the last sample. More...
 

Detailed Description

Stores a data set consisting of multiple samples, where each sample is the observed joint state of some variables.

Note
Each sample can describe the joint state of a different set of variables, in order to be able to deal with missing data.
Author
Charles Vaske
Examples:
example_sprinkler_em.cpp.

Member Typedef Documentation

typedef std::map<Var, size_t> dai::Evidence::Observation

Stores joint state of a set of variables.

Iterator over the samples.

Constant iterator over the samples.

Constructor & Destructor Documentation

dai::Evidence::Evidence ( )
inline

Default constructor.

dai::Evidence::Evidence ( std::vector< Observation > &  samples)
inline

Construct from samples.

Member Function Documentation

void dai::Evidence::addEvidenceTabFile ( std::istream &  is,
FactorGraph fg 
)

Read in tabular data from a stream and add the read samples to *this.

Parameters
isInput stream in .tab file format, describing joint observations of variables in fg
fgFactor graph describing the corresponding variables
See also
Evidence (.tab) file format
Exceptions
INVALID_EVIDENCE_FILEif the input stream is not valid
Examples:
example_sprinkler_em.cpp.
size_t dai::Evidence::nrSamples ( ) const
inline

Returns number of stored samples.

Examples:
example_sprinkler_em.cpp.
iterator dai::Evidence::begin ( )
inline

Returns iterator that points to the first sample.

const_iterator dai::Evidence::begin ( ) const
inline

Returns constant iterator that points to the first sample.

iterator dai::Evidence::end ( )
inline

Returns iterator that points beyond the last sample.

const_iterator dai::Evidence::end ( ) const
inline

Returns constant iterator that points beyond the last sample.

void dai::Evidence::addEvidenceTabFile ( std::istream &  is,
std::map< std::string, Var > &  varMap 
)
private

Read in tabular data from a stream and add the read samples to *this.

Member Data Documentation

std::vector<Observation> dai::Evidence::_samples
private

Each sample is an observed joint state of some variables.


The documentation for this class was generated from the following files: