Statismo  0.10.1
 All Classes Namespaces Functions Typedefs
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
statismo::DataManager< T > Class Template Reference

Manages Training and Test Data for building Statistical Models and provides functionality for Crossvalidation. More...

#include <DataManager.h>

Inheritance diagram for statismo::DataManager< T >:
Inheritance graph

Public Types

typedef Representer< T > RepresenterType
 
typedef
RepresenterType::DatasetPointerType 
DatasetPointerType
 
typedef
RepresenterType::DatasetConstPointerType 
DatasetConstPointerType
 
typedef DataItem< T > DataItemType
 
typedef DataItemWithSurrogates< T > DataItemWithSurrogatesType
 
typedef std::list< const
DataItemType * > 
DataItemListType
 
typedef CrossValidationFold< T > CrossValidationFoldType
 
typedef std::list
< CrossValidationFoldType
CrossValidationFoldListType
 

Public Member Functions

void Delete ()
 
virtual ~DataManager ()
 
virtual void AddDataset (DatasetConstPointerType dataset, const std::string &URI)
 
virtual void Save (const std::string &filename) const
 
DataItemListType GetData () const
 
unsigned GetNumberOfSamples () const
 
CrossValidationFoldListType GetCrossValidationFolds (unsigned nFolds, bool randomize=true) const
 
CrossValidationFoldListType GetLeaveOneOutCrossValidationFolds () const
 

Static Public Member Functions

static DataManager< T > * Create (const RepresenterType *representer)
 
static DataManager< T > * Load (Representer< T > *representer, const std::string &filename)
 

Protected Member Functions

 DataManager (const RepresenterType *representer)
 
 DataManager (const DataManager< T > &orig)
 
DataManageroperator= (const DataManager< T > &rhs)
 

Protected Attributes

RepresenterType * m_representer
 
DataItemListType m_DataItemList
 

Detailed Description

template<typename T>
class statismo::DataManager< T >

Manages Training and Test Data for building Statistical Models and provides functionality for Crossvalidation.

The DataManager class provides functionality for loading and managing data sets to be used in the statistical model. The datasets are loaded either by using DataManager::AddDataset or directly from a hdf5 File using the Load function. Per default all the datasets are marked as training data. It is, however, often useful to leave a few datasets out to validate the model. For this purpose, the DataManager class implements basic crossvalidation functionality.

Note that while Dataset are provided, the Representer class automatically converts them into Samples (Representer::DatasetToSample) For efficiency purposes, the data is internally stored as a large matrix, using the internal SampleVector representation (Representer::DatasetToSample). Furthermore, Statismo emphasizes on traceability, and ties information with the datasets, such as the original filename. This means that when accessing the data stored in the DataManager, one gets a DataItem structure

See Also
Representer
DataItem

Constructor & Destructor Documentation

template<typename T >
statismo::DataManager< T >::~DataManager ( )
virtual

Destructor

Member Function Documentation

template<typename T >
void statismo::DataManager< T >::AddDataset ( DatasetConstPointerType  dataset,
const std::string &  URI 
)
virtual

Add a dataset to the data manager.

Parameters
datasetthe dataset to be added
URIA string containing the URI of the given dataset. This is only added as an info to the metadata.

While it is not strictly necessary, and sometimes not even possible, to specify a URI for the given dataset, it is strongly encouraged to add a description. The string will be added to the metadata and stored with the model. Having this information stored with the model may prove valuable at a later point in time.

template<typename T>
static DataManager<T>* statismo::DataManager< T >::Create ( const RepresenterType *  representer)
inlinestatic

Factory method that creates a new instance of a DataManager class

template<typename T>
void statismo::DataManager< T >::Delete ( )
inline

Destroy the object. The same effect can be achieved by deleting the object in the usual way using the c++ delete keyword.

template<typename T >
DataManager< T >::CrossValidationFoldListType statismo::DataManager< T >::GetCrossValidationFolds ( unsigned  nFolds,
bool  randomize = true 
) const

Assigns the data to one of n Folds to be used for cross validation. This method has to be called before cross validation can be started.

Parameters
nFoldsThe number of folds used in the crossvalidation
randomizeIf true, the data will be randomly assigned to the nfolds, otherwise the order with which it was added is preserved
template<typename T >
DataManager< T >::DataItemListType statismo::DataManager< T >::GetData ( ) const

return a list with all the sample data objects managed by the data manager

See Also
DataItem
template<typename T >
DataManager< T >::CrossValidationFoldListType statismo::DataManager< T >::GetLeaveOneOutCrossValidationFolds ( ) const

Generates Leave-one-out cross validation folds

template<typename T>
unsigned statismo::DataManager< T >::GetNumberOfSamples ( ) const
inline

returns the number of samples managed by the datamanager

template<typename T>
DataManager< T > * statismo::DataManager< T >::Load ( Representer< T > *  representer,
const std::string &  filename 
)
static

Create a new dataManager, with the data stored in the given hdf5 file

template<typename T >
void statismo::DataManager< T >::Save ( const std::string &  filename) const
virtual

Saves the data matrix and all URIs into an HDF5 file.

Parameters
filename

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