Direct Graphical Models  v.1.7.0
DirectGraphicalModels::CBaseRandomModel Class Referenceabstract

Base abstract class for random model training. More...

#include <BaseRandomModel.h>

Inheritance diagram for DirectGraphicalModels::CBaseRandomModel:

Public Member Functions

 CBaseRandomModel (byte nStates)
 Constructor. More...
 
virtual ~CBaseRandomModel (void)
 
virtual void reset (void)=0
 Resets class variables. More...
 
virtual void save (const std::string &path, const std::string &name=std::string(), short idx=-1) const
 Saves the training data. More...
 
virtual void load (const std::string &path, const std::string &name=std::string(), short idx=-1)
 Loads the training data. More...
 
byte getNumStates (void) const
 Returns number of states (classes) More...
 

Protected Member Functions

virtual void saveFile (FILE *pFile) const =0
 Saves the random model into the file. More...
 
virtual void loadFile (FILE *pFile)=0
 Loads the random model from the file. More...
 
std::string generateFileName (const std::string &path, const std::string &name, short idx) const
 Generates name of the data file for storing random model parameters. More...
 

Protected Attributes

byte m_nStates
 The number of states (classes) More...
 

Detailed Description

Base abstract class for random model training.

This class defines basic serialization interface.

Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 24 of file BaseRandomModel.h.

Constructor & Destructor Documentation

◆ CBaseRandomModel()

DirectGraphicalModels::CBaseRandomModel::CBaseRandomModel ( byte  nStates)
inline

Constructor.

Parameters
nStatesNumber of states (classes).

Definition at line 31 of file BaseRandomModel.h.

◆ ~CBaseRandomModel()

virtual DirectGraphicalModels::CBaseRandomModel::~CBaseRandomModel ( void  )
inlinevirtual

Definition at line 32 of file BaseRandomModel.h.

Member Function Documentation

◆ generateFileName()

std::string DirectGraphicalModels::CBaseRandomModel::generateFileName ( const std::string &  path,
const std::string &  name,
short  idx 
) const
protected

Generates name of the data file for storing random model parameters.

This function generated the file name as follows: fileName="<path><name>_<idx>.dat", where idx always has 5 symbols.

Parameters
pathPath to the folder, containing the data file.
nameName of data file.
idxIndex of the data file. If idx is negative, index will not be added to the file name.
Returns
File name.

Definition at line 28 of file BaseRandomModel.cpp.

Here is the caller graph for this function:

◆ getNumStates()

byte DirectGraphicalModels::CBaseRandomModel::getNumStates ( void  ) const
inline

Returns number of states (classes)

Returns
Number of states (features)

Definition at line 59 of file BaseRandomModel.h.

Here is the caller graph for this function:

◆ load()

void DirectGraphicalModels::CBaseRandomModel::load ( const std::string &  path,
const std::string &  name = std::string(),
short  idx = -1 
)
virtual

Loads the training data.

Allows to re-use the class. Loads data to the file: "<path><name>_<idx>.dat".

Parameters
pathPath to the folder, containing the data file.
nameName of data file. If empty, will be generated automatically from the class name.
idxIndex of the data file. Negative value means no index.

Reimplemented in DirectGraphicalModels::CTrainNodeMsRF, DirectGraphicalModels::CTrainNodeCvRF, DirectGraphicalModels::CTrainEdgeConcat< Trainer, Concatenator >, DirectGraphicalModels::CTrainLinkNested< Trainer >, DirectGraphicalModels::CTrainNodeCvANN, DirectGraphicalModels::CTrainNodeCvGMM, DirectGraphicalModels::CTrainNodeCvSVM, DirectGraphicalModels::CTrainNodeKNN, and DirectGraphicalModels::CTrainNodeCvKNN.

Definition at line 19 of file BaseRandomModel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFile()

◆ reset()

◆ save()

void DirectGraphicalModels::CBaseRandomModel::save ( const std::string &  path,
const std::string &  name = std::string(),
short  idx = -1 
) const
virtual

Saves the training data.

Allows to re-use the class. Stores data to the file: "<path><name>_<idx>.dat".

Parameters
pathPath to the destination folder.
nameName of data file. If empty, will be generated automatically from the class name.
idxIndex of the destination file. Negative value means no index.

Reimplemented in DirectGraphicalModels::CTrainNodeMsRF, DirectGraphicalModels::CTrainNodeCvRF, DirectGraphicalModels::CTrainEdgeConcat< Trainer, Concatenator >, DirectGraphicalModels::CTrainLinkNested< Trainer >, DirectGraphicalModels::CTrainNodeCvANN, DirectGraphicalModels::CTrainNodeCvGMM, DirectGraphicalModels::CTrainNodeCvSVM, DirectGraphicalModels::CTrainNodeKNN, and DirectGraphicalModels::CTrainNodeCvKNN.

Definition at line 7 of file BaseRandomModel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveFile()

Member Data Documentation

◆ m_nStates

byte DirectGraphicalModels::CBaseRandomModel::m_nStates
protected

The number of states (classes)

Definition at line 87 of file BaseRandomModel.h.


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