31 #ifndef GRT_CONTINUOUS_HIDDEN_MARKOV_MODEL_HEADER 32 #define GRT_CONTINUOUS_HIDDEN_MARKOV_MODEL_HEADER 35 #include "../../Util/GRTCommon.h" 36 #include "../../CoreModules/MLBase.h" 42 ContinuousHiddenMarkovModel(
const UINT downsampleFactor = 5,
const UINT delta = 1,
const bool autoEstimateSigma =
true,
const Float sigma = 10.0);
62 virtual bool reset()
override;
70 virtual bool clear()
override;
78 virtual bool save( std::fstream &file )
const override;
86 virtual bool load( std::fstream &file )
override;
88 virtual bool print()
const override;
90 UINT getNumStates()
const {
return numStates; }
92 UINT getClassLabel()
const {
return classLabel; }
94 Float getLoglikelihood()
const {
return loglikelihood; }
96 Float getPhase()
const {
return phase; }
98 Vector< UINT > getEstimatedStates()
const {
return estimatedStates; }
102 bool setDownsampleFactor(
const UINT downsampleFactor);
112 bool setModelType(
const UINT modelType);
126 bool setDelta(
const UINT delta);
128 bool setSigma(
const Float sigma);
130 bool setAutoEstimateSigma(
const bool autoEstimateSigma);
141 UINT downsampleFactor;
145 bool autoEstimateSigma;
virtual bool predict_(VectorFloat &inputVector)
Vector< UINT > estimatedStates
The estimated states for prediction.
Float cThreshold
The classification threshold for this model.
This class acts as the main interface for using a Hidden Markov Model.
MatrixFloat a
The transitions probability matrix.
Float loglikelihood
The log likelihood of an observation sequence given the modal, calculated by the forward method...
VectorFloat pi
The state start probability vector.
UINT modelType
The model type (LEFTRIGHT, or ERGODIC)
virtual bool save(const std::string &filename) const
UINT delta
The number of states a model can move to in a LEFTRIGHT model.
CircularBuffer< VectorFloat > observationSequence
A buffer to store data for realtime prediction.
virtual bool print() const
UINT classLabel
The class label associated with this model.
MatrixFloat sigmaStates
The sigma value for each state.
virtual bool train_(ClassificationData &trainingData)
virtual bool load(const std::string &filename)
MatrixFloat b
The emissions probability matrix.
UINT timeseriesLength
The length of the training timeseries.
This is the main base class that all GRT machine learning algorithms should inherit from...
UINT numStates
The number of states for this model.