I'm using the code below to fit an HMM model with two hidden states, a vocabulary of size 5 (so 5 possible symbols), and a list of sequences, each with 10 observations.
I don't understand why
Код: Выделить всё
model.emissionprob_Код: Выделить всё
(2, 10)Код: Выделить всё
from hmmlearn import hmm
import numpy as np
import pandas as pd
# Define the sequences
sequences = np.random.randint(1, 6, size=(100000, 10)).tolist()
# Convert sequences to numpy array
sequences_np = np.array(sequences)
# Create and fit the Multinomial HMM model with 2 hidden states
model = hmm.MultinomialHMM(n_components=2)
model.fit(sequences_np)
# Print the model parameters
print("Initial state distribution:")
print(model.startprob_)
print("\nTransition matrix:")
print(model.transmat_)
print("\nEmission probabilities:")
print(model.emissionprob_)
Источник: https://stackoverflow.com/questions/781 ... nprob-size