Skip to content

Error when trying to perform forward algorithm #1

@Jk9jk9

Description

@Jk9jk9

@Nikhil-Kumar-Patel - this is a really good project! However, I am receiving an error, below, when attempting to perform the forward algorithm. Did you experience this?

/usr/local/lib/python3.10/dist-packages/hmmlearn/hmm.py:352: RuntimeWarning: invalid value encountered in divide
self.means_ = ((means_weight * means_prior + stats['obs'])
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.
WARNING:hmmlearn.base:Some rows of transmat_ have zero sum because no transition from the state was ever observed.

ValueError Traceback (most recent call last)
in <cell line: 14>()
38
39 # Perform the forward algorithm to compute log-likelihoods and forward probabilities
---> 40 log_likelihoods, fwd = model.score_samples(obs[i:i+T])
41
42 # Calculate the number of parameters for the model

4 frames
/usr/local/lib/python3.10/dist-packages/hmmlearn/base.py in _check_sum_1(self, name)
949 s = getattr(self, name).sum(axis=-1)
950 if not np.allclose(s, 1):
--> 951 raise ValueError(
952 f"{name} must sum to 1 (got {s:.4f})"
953 if s.ndim == 0

ValueError: startprob_ must sum to 1 (got nan)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions