You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a few covariates for transition, but when I am using the sample code provided to view transition probabilities, it is throwing an error.
For Example : covariates_transition = ['a','b','c','d','e', 'f','g','h','i']
When using print(np.exp(SHMM.model_transition[0].predict_log_proba(np.array([[]])))),
I am getting an error : X has 1 features per sample; expecting 10. How can I get the transition probabilities for the two hidden state model with transition covariates.
Also, how can I get the most likely state for each observation? In hmmlearn ,
remodel = hmm.GaussianHMM(n_components=2).fit(X, lengths)
Z3 = remodel.predict(X) provides the hidden states, how can i get that in this model.
Thank you for all the help.
The text was updated successfully, but these errors were encountered:
You probably have a covariate (input) associated with the transition probabilities. For the first question I did:
# the number of zeros inside np.array() should be equal to the number of your covariates, I have two inputs.
empty = np.array([[1, 0, 0]]) # 1 for constant
SHMM0.model_transition[0].fit_intercept = False
SHMM0.model_transition[1].fit_intercept = False
print(np.exp(SHMM0.model_transition[0].predict_log_proba(empty)))
print(np.exp(SHMM0.model_transition[1].predict_log_proba(empty)))
This gets the transition probabilities for when your covariates are all 0 (except the constant).
Hello
I am using a few covariates for transition, but when I am using the sample code provided to view transition probabilities, it is throwing an error.
For Example : covariates_transition = ['a','b','c','d','e', 'f','g','h','i']
When using print(np.exp(SHMM.model_transition[0].predict_log_proba(np.array([[]])))),
I am getting an error : X has 1 features per sample; expecting 10. How can I get the transition probabilities for the two hidden state model with transition covariates.
Also, how can I get the most likely state for each observation? In hmmlearn ,
remodel = hmm.GaussianHMM(n_components=2).fit(X, lengths)
Z3 = remodel.predict(X) provides the hidden states, how can i get that in this model.
Thank you for all the help.
The text was updated successfully, but these errors were encountered: