HiddenMarkovModel: HiddenMarkovModel

View source: R/HiddenMarkovModel.R

HiddenMarkovModelR Documentation

HiddenMarkovModel

Description

HiddenMarkovModel using Rhmm package.

Procedure:

1. Selection of the number of states (Knowledge Discovery)

2. the Baum-Welch algorithm (generalized EM) determines the transition matrix P and the output probability

3. Veterbi algorithm: Determination of the probable sequence of states for a given observation, i.e. clustering is reproduced as output

Usage

HiddenMarkovModel(Data,ClusterNo,DistributionName='NORMAL',

Iterations=500,PriorClassification,PlotIt=TRUE,Silent=TRUE)

Arguments

Data

[1:n,1:d] d-dimensional data of n cases

ClusterNo

number of states, k

DistributionName

Normal==gaussian distributions

Iterations

number of maximal iteration steps

PriorClassification

Optional, to be compared with HMM

PlotIt

Optional, Plots the distributions of HMMmodell

Silent

Optional, additional outputs during the process of the function, e.g. summary(HMMmodell)

Details

"Hidden", since only time series given, but no actual states. States cannot be observed The output in a state is probalistic. The output in one state is therefore probalistic, since neither the transition probability nor the states are known. The number must be specified using a cluster procedure or from expert knowledge. The states should have semantics.

Value

List of

HMMmodell

please see HMMFit

HMM_means

[1:k] means of distributions, please see distributionSet

HMM_SDs

[1:k] standard deviations of distributions, please see distributionSet

HMM_weights

[1:k] weights of distributions

Uebergangsmatrix

Transition matrix, please see HMMSet

VitPath

please see viterbi

HMMcls

[1:n] classification defining which datapoint (case) belongs to which case

XTable

if PriorClassification given, compares to HMMcls

Accuracy

if PriorClassification given, compares to HMMcls

Author(s)

Michael Thrun

References

Bilmes, Jeff A.: A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models http://ssli.ee.washington.edu/people/bilmes/mypapers/em.ps.gz, 1997.

See Also

Baum-Welch-Algorithmus (generalisierter EM): HMMFit

Viterbi-Algorithmus: viterbi,HMMFit

Examples


requireNamespace('Rhmm')
data(n1d_3s)
Data=as.matrix(obs_n1d_3s[[1]])
model=HiddenMarkovModel(Data,3,PlotIt = T,Silent = T)

TagNR=1:nrow(Data)
plot(TagNR,Data[,1],col=model$HMMcls,main='HMM states with Viterbi',pch=20)
legend("topright", inset = c(-0.2, 0), legend = sort(unique(model$HMMcls)), 
            fill =  sort(unique(model$HMMcls)))


Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.