MachineIntelligenceCore:Algorithms
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE > Class Template Reference

Class responsible for collection of data during experiments end exporting the results to files. More...

#include <DataCollector.hpp>

Public Member Functions

 DataCollector ()
 
virtual ~DataCollector ()
 
void createContainer (LABEL_TYPE label_, DATA_TYPE min_, DATA_TYPE max_, mic::types::color_rgba color_=mic::types::color_rgba(255, 255, 255, 180), float line_width_=1.0f)
 
void createContainer (LABEL_TYPE label_, mic::types::color_rgba color_=mic::types::color_rgba(255, 255, 255, 180), float line_width_=1.0f)
 
void addDataToContainer (LABEL_TYPE label_, DATA_TYPE value_)
 
DataContainerPtr< DATA_TYPE > getDataFromContainer (LABEL_TYPE label_)
 
DataContainers< LABEL_TYPE,
DATA_TYPE > 
getContainers ()
 
void exportDataToCsv (std::string filename_="data.csv")
 

Static Public Member Functions

static void exportVectorToCsv (std::string filename_, std::string label_, std::vector< DATA_TYPE > data_, bool append_=false)
 
static void exportValueToCsv (std::string filename_, std::string label_, DATA_TYPE value_, bool append_=false)
 
static void exportCommentToCsv (std::string filename_, std::string exportCommentToCsv, bool append_=false)
 
static void exportMatrixToCsv (std::string filename_, std::string label_, std::shared_ptr< mic::types::Matrix< DATA_TYPE > > matrix_, bool append_=false)
 
static void exportMatricesToCsv (std::string filename_, std::string label_, std::vector< mic::types::MatrixPtr< DATA_TYPE > > data_, bool append_=false)
 

Protected Attributes

DataContainers< LABEL_TYPE,
DATA_TYPE > 
containers
 

Detailed Description

template<class LABEL_TYPE, class DATA_TYPE>
class mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >

Class responsible for collection of data during experiments end exporting the results to files.

Template Parameters
LABEL_TYPETemplate parameter denoting the label type.
DATA_TYPETemplate parameter denoting basic used datatype.
Author
tkornuta

Definition at line 114 of file DataCollector.hpp.

Constructor & Destructor Documentation

template<class LABEL_TYPE , class DATA_TYPE >
mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::DataCollector ( )
inline

Constructor. Empty for now.

Definition at line 119 of file DataCollector.hpp.

template<class LABEL_TYPE , class DATA_TYPE >
virtual mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::~DataCollector ( )
inlinevirtual

Destructor. Empty for now.

Definition at line 124 of file DataCollector.hpp.

Member Function Documentation

template<class LABEL_TYPE , class DATA_TYPE >
void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::addDataToContainer ( LABEL_TYPE  label_,
DATA_TYPE  value_ 
)
inline

Adds new value to the container.

Parameters
label_Name of the container.
value_Value to be added.

Definition at line 174 of file DataCollector.hpp.

References mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::containers.

template<class LABEL_TYPE , class DATA_TYPE >
void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::createContainer ( LABEL_TYPE  label_,
DATA_TYPE  min_,
DATA_TYPE  max_,
mic::types::color_rgba  color_ = mic::types::color_rgba(255, 255, 255, 180),
float  line_width_ = 1.0f 
)
inline

Creates new data container for a given label. Sets min and max values.

Parameters
label_Name of the container.
min_Minimum value (used in visualization).
min_Maximum value (used in visualization).
color_Colour of line/label (used in visualization).
line_width_Line width (used in visualization).

Definition at line 134 of file DataCollector.hpp.

References mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::containers.

template<class LABEL_TYPE , class DATA_TYPE >
void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::createContainer ( LABEL_TYPE  label_,
mic::types::color_rgba  color_ = mic::types::color_rgba(255, 255, 255, 180),
float  line_width_ = 1.0f 
)
inline

Creates new data container for a given label. This container will automatically scale (find the min/max values when adding new ones)

Parameters
label_Name of the container.
color_Colour of line/label (used in visualization).
line_width_Line width (used in visualization).

Definition at line 154 of file DataCollector.hpp.

References mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::containers.

template<class LABEL_TYPE , class DATA_TYPE >
static void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::exportCommentToCsv ( std::string  filename_,
std::string  exportCommentToCsv,
bool  append_ = false 
)
inlinestatic

Exports a comment to file.

Parameters
filename_Output filename.
comment_Comment to be added (in a separate line).
append_Flag denoting whether data should be added to existing data in a file or file should be truncated.

Definition at line 303 of file DataCollector.hpp.

template<class LABEL_TYPE , class DATA_TYPE >
void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::exportDataToCsv ( std::string  filename_ = "data.csv")
inline

Exports collected data to csv.

Parameters
filename_Output filename (=data.csv).

Definition at line 230 of file DataCollector.hpp.

References mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::containers.

template<class LABEL_TYPE , class DATA_TYPE >
static void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::exportMatricesToCsv ( std::string  filename_,
std::string  label_,
std::vector< mic::types::MatrixPtr< DATA_TYPE > >  data_,
bool  append_ = false 
)
inlinestatic

Exports vector of matrices to csv (in Row-major order).

Parameters
filename_Output filename.
label_Data label (written in file, above the line containing data)
data_Data - a vector of Eigen::Matrix pointers.
append_Flag denoting whether data should be added to existing data in a file or file should be truncated.

Definition at line 354 of file DataCollector.hpp.

template<class LABEL_TYPE , class DATA_TYPE >
static void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::exportMatrixToCsv ( std::string  filename_,
std::string  label_,
std::shared_ptr< mic::types::Matrix< DATA_TYPE > >  matrix_,
bool  append_ = false 
)
inlinestatic

Exports Eigen (or derived) matrix to a csv file (in Row-major order).

Parameters
filename_Output filename.
label_Data label (written in file, above the line containing data)
matrix_(A shared pointer to) Matrix to be exported.
append_Flag denoting whether data should be added to existing data in a file or file should be truncated.

Definition at line 324 of file DataCollector.hpp.

template<class LABEL_TYPE , class DATA_TYPE >
static void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::exportValueToCsv ( std::string  filename_,
std::string  label_,
DATA_TYPE  value_,
bool  append_ = false 
)
inlinestatic

Exports a single value to file.

Parameters
filename_Output filename.
label_Data label (written in file, before the data)
data_Data (a single value).
append_Flag denoting whether data should be added to existing data in a file or file should be truncated.

Definition at line 283 of file DataCollector.hpp.

Referenced by main().

template<class LABEL_TYPE , class DATA_TYPE >
static void mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::exportVectorToCsv ( std::string  filename_,
std::string  label_,
std::vector< DATA_TYPE >  data_,
bool  append_ = false 
)
inlinestatic

Exports the vector to csv.

Parameters
filename_Output filename.
label_Data label (written in file, above the line containing data)
data_Data (vector)
append_Flag denoting whether data should be added to existing data in a file or file should be truncated.

Definition at line 257 of file DataCollector.hpp.

Referenced by main().

template<class LABEL_TYPE , class DATA_TYPE >
DataContainers< LABEL_TYPE, DATA_TYPE > mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::getContainers ( )
inline

Returns the containers.

Returns
Map of all stored containers.

Definition at line 220 of file DataCollector.hpp.

References mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::containers.

template<class LABEL_TYPE , class DATA_TYPE >
DataContainerPtr<DATA_TYPE> mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::getDataFromContainer ( LABEL_TYPE  label_)
inline

Returns the data stored by container with a given label.

Parameters
label_Name of the container.
Returns
Container with given label. If container not found - it will return an empty container.

Definition at line 198 of file DataCollector.hpp.

References mic::utils::DataCollector< LABEL_TYPE, DATA_TYPE >::containers.

Member Data Documentation


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