Wednesday, September 11, 2013

Collection of lecture on Markov Chains & Hidden Markov Models

The first set of lectures introduce markov model, markov chains, and extend the markov chain to HMMs

(ML 14.1) Markov models - motivating examples
http://www.youtube.com/watch?v=7KGdE2AK_MQ

(ML 14.2) Markov chains (discrete-time) (part 1)
http://www.youtube.com/watch?v=WUjt98HcHlk

(ML 14.3) Markov chains (discrete-time) (part 2)
http://www.youtube.com/watch?v=j6OUj9tleVM

(ML 14.4) Hidden Markov models (HMMs) (part 1)  
http://www.youtube.com/watch?v=TPRoLreU9lA

===========================================
The following lecture is a more detailed, intuitive explaination about HMMs

Very intuitive
http://www.youtube.com/watch?v=jY2E6ExLxaw

=============================================
 HMM & stock prediction
http://www.slideshare.net/ChiuYW/hidden-markov-model-stock-prediction




  • TOOL KIT
  • R Package– HMM– RHMM
    JAVA– JHMM
    Python– Scikit Learn
  • DEMO
  • GET DATASET
  • library(quantmod)
    getSymbols("^TWII")
    chartSeries(TWII)
    TWII_Subset<- p="" start="as.Date(" window="">TWII_Train <- -="" cbind="" lose="" olume="" p="" pen="" twii_subset="" ubset="">



  • BUILD HMM MODEL
  • # Include RHMM Library
    library(RHmm)

    # Baum-Welch Algorithm
    hm_model <- hmmfit="" nstates="5)</p" obs="TWII_Train">
    # Viterbi Algorithm
    VitPath <- hm_model="" p="" twii_train="" viterbi="">


  • SCATTER PLOT
  • TWII_Predict <- cbind="" lose="" p="" states="" ubset="" vitpath=""> chartSeries(TWII_Predict[,1])
    addTA(TWII_Predict[TWII_Predict[,2]==1,1],on=1,type="p",col=5,pch=25)
    addTA(TWII_Predict[TWII_Predict[,2]==2,1],on=1,type="p",col=6,pch=24)
    addTA(TWII_Predict[TWII_Predict[,2]==3,1],on=1,type="p",col=7,pch=23)
    addTA(TWII_Predict[TWII_Predict[,2]==4,1],on=1,type="p",col=8,pch=22)
    addTA(TWII_Predict[TWII_Predict[,2]==5,1],on=1,type="p",col=10,pch=21)


    No comments:

    Post a Comment