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
Describe the bug
I am attempting to train a DenseHMM (code below) with 1000 sequences of length 61 observations that have a single categorical emission. But the training does not succeed. I presume that I am using the APIs incorrectly, so some direction would be appreciated.
Based on the documentation I believe I should be providing Categorical(n_categories=[n_categories]) but Categorical._initialize requires n_categories to be an int, hence Categorical(n_categories=n_categories).
$ python
Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pomegranate
>>> pomegranate.__version__
'1.1.1'
To Reproduce
frompomegranate.hmmimportDenseHMMfrompomegranate.distributionsimportCategoricalimporttorchn_hidden_states=123n_categories=61distributions= [
Categorical(n_categories=n_categories)
for_inrange(n_hidden_states)
]
model=DenseHMM(
distributions,
max_iter=10,
verbose=True
)
xs=torch.randint(low=0, high=n_categories, size=(1000, 61, 1))
print(xs)
print(xs.shape)
assertxs.shape[0] ==1000# xs.shape[0] is the number of sequencesassertxs.shape[1] ==n_categoriesassertxs.shape[2] ==1model.fit(xs)
print(model.predict(xs))
The text was updated successfully, but these errors were encountered:
Describe the bug
I am attempting to train a DenseHMM (code below) with 1000 sequences of length 61 observations that have a single categorical emission. But the training does not succeed. I presume that I am using the APIs incorrectly, so some direction would be appreciated.
Based on the documentation I believe I should be providing
Categorical(n_categories=[n_categories])
butCategorical._initialize
requires n_categories to be an int, henceCategorical(n_categories=n_categories)
.Output from the script:
Version information
To Reproduce
The text was updated successfully, but these errors were encountered: