Skip to content

Failure with new hmmlearn 0.3.0 #62

@muschellij2

Description

@muschellij2

Get errors with new hmmlearn and rf model:
MultinomialHMM has undergone major changes. The previous version was implementing a CategoricalHMM (a special case of MultinomialHMM). This new implementation follows the standard definition for a Multinomial distribution (e.g. as in https://en.wikipedia.org/wiki/Multinomial_distribution). See these issues for details:
hmmlearn/hmmlearn#335
hmmlearn/hmmlearn#340

Traceback (most recent call last):
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/stepcount/models.py", line 244, in predict_from_frame
Y, W, Z = self.predict(X, return_walk=True, return_step_times=True)
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/stepcount/models.py", line 195, in predict
W_ = self.wd.predict(X_, groups).astype('bool')
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/stepcount/models.py", line 358, in predict
W = self.hmms.predict(W, groups=groups)
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/stepcount/hmm_utils.py", line 48, in predict
return self.hmmlearn_fit_predict(Y, groups=groups, method='predict')
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/stepcount/hmm_utils.py", line 98, in hmmlearn_fit_predict
_hmm, _score, _Y_pred = hmmlearn_fit_predict(Y[groups == g], groups=None, **hmm_params)
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/stepcount/hmm_utils.py", line 195, in hmmlearn_fit_predict
hmm.fit(Y_train, lengths_from_groups(groups_train))
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/hmmlearn/base.py", line 468, in fit
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/hmmlearn/hmm.py", line 895, in _init
res = np.zeros((n_samples, self.n_components))
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/hmmlearn/base.py", line 908, in _init
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/hmmlearn/_emissions.py", line 317, in _check_and_set_n_features
File "/users/jmuschel/.conda/envs/stepcount/lib/python3.9/site-packages/hmmlearn/base.py", line 527, in _check_and_set_n_features
"transition from the state was ever observed.")
ValueError: Unexpected number of dimensions, got 1 but expected 2

Reverting to 0.2.7 fixed this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions