Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multivariate gaussian emissions #38

Closed
ucabqll opened this issue Jul 15, 2022 · 0 comments
Closed

Multivariate gaussian emissions #38

ucabqll opened this issue Jul 15, 2022 · 0 comments

Comments

@ucabqll
Copy link

ucabqll commented Jul 15, 2022

Hello,

I have blank inputs and am trying to reconcile the results between IOHMM and hmmlearn.GaussianHMM. Which I assume should be the standard HMM model.

USHMM = UnSupervisedIOHMM(num_states=2, max_EM_iter=200, EM_tol=1e-6)

USHMM.set_models(model_emissions = [OLS()],  
                                    model_transition=CrossEntropyMNL(solver='lbfgs'), 
                                    model_initial=CrossEntropyMNL(solver='lbfgs'))

USHMM.set_inputs(covariates_initial = [], covariates_transition = [], covariates_emissions = [[]])
USHMM.set_outputs([['feature1'],['feature2'],['feature3'],['feature4']] ) #multiple univariate emissions
USHMM.set_data([train_df])

The above gives me almost same results to

import hmmlearn as hmm

model = hmm.GaussianHMM(n_components = 2, covariance_type = "diag")
model.fit(train_df)

This is expected since "diag" implies that all observations are independent and simply individual emissions. The IOHMM model in this case treats it as 4 independent emissions so the results are not too different and are able to reconcile.

However, if I switch to a full multivariate covariate emission

USHMM = UnSupervisedIOHMM(num_states=2, max_EM_iter=200, EM_tol=1e-6)

USHMM.set_models(model_emissions = [OLS()],  
                                    model_transition=CrossEntropyMNL(solver='lbfgs'), 
                                    model_initial=CrossEntropyMNL(solver='lbfgs'))

USHMM.set_inputs(covariates_initial = [], covariates_transition = [], covariates_emissions = [[]])
USHMM.set_outputs([['feature1','feature2','feature3','feature4']])  #multivariate emission
USHMM.set_data([train_df])

The gives me very different results compared to

model = hmm.GaussianHMM(n_components = 2, covariance_type = "full")
model.fit(train_df)

Where "full" means there would be a pxp covariance matrix under each state which is used as emissions to characterise the multivariate gaussian distribution. Is this expected or did I set-up the model incorrectly? Thanks

Best Regards,

@ucabqll ucabqll closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant