manitadayon / Auto_HMM

Hidden Markov Model
MIT License
34 stars 12 forks source link

How to use this dataset? #1

Open moryekram opened 2 years ago

moryekram commented 2 years ago

Hi Manitadayon, I am glad to find your code and thanks from sharig it. I am new in machine learning. Now I want to code for this paper and want to use this dataset . But i don't know how can i do this. Can you help me? I don't know exactly what is states in this paper and how give dataset to your code, and how wite code for this paper.

manitadayon commented 2 years ago

Hi For sure. I have a video on my YouTube channel on how to model dataset using a hidden Markov model : Hidden Markov Model (Modeling and Implementation) 

https://www.youtube.com/watch?v=1b-sd7gulFk&t=4s&ab_channel=AIandMLFundamentals

Please let me know if you still have questions.  Thanks Manie 

Sent from Yahoo Mail for iPhone

On Friday, January 21, 2022, 4:10 AM, moryekram @.***> wrote:

Hi Manitadayon, I am glad to find your code and thanks from sharig it. No i want to code for this paper and want to use this dataset . But i don't know how can i do this. Can you help me?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.***>

moryekram commented 2 years ago

Hello again. I watched your video but I don't know where to start. In paper, the first exec for 1,3,5,7,9 states and said that for example 5 states are better. But I don't know how to pass my dataset to your code ? How to get accuracy of multiple states? and so on. And excuse me, are you iranian? Can I write in Persian language? O may I have chat in social networks(because I have to deliver my project this monday)

On Sat, Jan 22, 2022 at 5:04 AM Chess_champion @.***> wrote:

Hi For sure. I have a video on my YouTube channel on how to model dataset using a hidden Markov model :Hidden Markov Model (Modeling and Implementation)

|

Hidden Markov Model (Modeling and Implementation)

By AI and ML Fundamentals

| |

|

|

Please let me know if you still have questions. Thanks Manie

Sent from Yahoo Mail for iPhone

On Friday, January 21, 2022, 4:10 AM, moryekram @.***> wrote:

Hi Manitadayon, I am glad to find your code and thanks from sharig it. No i want to code for this paper and want to use this dataset . But i don't know how can i do this. Can you help me?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/manitadayon/Auto_HMM/issues/1#issuecomment-1019007979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKGKNZN6KXOEQLXUYJJ633UXICRNANCNFSM5MPLL5HQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

manitadayon commented 2 years ago

Hi again, I posted another video just now and I explain Auto-HMM in detail.

moryekram commented 2 years ago

Unfortunately gives error "more than 23259samples in lengths array" when using Hmm_Testing. This is my dataset giroscopio_terra-1.csv this file is merge of 4 file with deletion rows that are not in any class , and this is my parameters Train_ratio=0.7 Cov_Type='diag' Max_state=3 Max_mixture=4 Iter=100 Feat=3 N=11077 T=69 flag=1 col_list = ["uptimeNanos", "x", "y", "z"] Path='mydataset/16/giroscopio_terra-1.csv' Data=pd.read_csv(Path, header=0, parse_dates=[0], index_col=0, usecols=col_list) Exam_HMM=Supervised_HMM(Train_ratio,Cov_Type,Max_state,Max_mixture,Iter,Feat,N,T,Data,flag) arr = Exam_HMM.Best_States() print(Exam_HMM.score) Can you give dataset to your code and show the best states for example?

manitadayon commented 2 years ago

I looked at the data. There are two options: 1- Unsupervised HMM, you can use Auto-HMM and ignore the label column and please also ignore the time stamp. 2- Use the label column (still ignore the timestamp) and use the supervised packages such as this in MATLAB which is very easy https://www.mathworks.com/help/stats/hidden-markov-models-hmm.html

You can also try this:

from Hidden_Markov_Model import * from Hidden_Markov_Model.HMM import Supervised_HMM import time

Start=time.time() Train_ratio=0.9 Cov_Type='diag' Max_state=7 Max_mixture=4 Iter=100 Feat=1 N=3 T=10000 flag=1 Path = 'Path to CSV' Data=pd.read_csv(Path) Data2 = Data.iloc[:,2:5] Data2 = Data2.T Exam_HMM=Supervised_HMM(Train_ratio,Cov_Type,Max_state,Max_mixture,Iter,Feat,N,T,Data2,flag) Exam_HMM.Best_States() END=time.time() print('Total Time Takes in seconds',END-Start)

You can also use hmmlearn and feed the observation separately instead of using Auto-HMM.

moryekram commented 2 years ago

Hi again. Excuse me.

This is my result with params and using "hmm_classifier" library:

Data=pd.read_csv(Path, header=0) x = Data.iloc[:,3:6].to_numpy() x = x.reshape(64645,1,3) y = Data.iloc[:,6:7].to_numpy() y = y.reshape(-1) model = HMM_classifier(hmm.GaussianHMM()) model.fit(x,y) pred = model.predict_proba([[-0.352388077,0.502128386,0.390059343]])

library: hmmclassifier -> https://github.com/elmihailol/HMM-classifier result: error: rows of transmat must sum to 1.0 (got {0})

Can you show me how to use hmmlearn step by step to pass 70% data for train and 30% for test and get probability for each class and also get accuracy but with my data? I am so confused and my time is running out, Thanks