HMM Model¶
Hidden Markov Model implementation using hmmlearn.
pitch_sequencing.models.hmm_model
¶
HMM model wrapper using hmmlearn CategoricalHMM.
HMMModel
¶
Bases: BaseModel
Hidden Markov Model for pitch sequence prediction.
Source code in src/pitch_sequencing/models/hmm_model.py
fit(X_train, y_train, X_val=None, y_val=None, **kwargs)
¶
Train HMM by sweeping n_components and picking best by validation accuracy.
For HMM, X_train is expected to be a flat 2D array of shape (n_samples, 1) with encoded pitch types (the HMM uses its own flat encoding, not windowed). y_train is the same flat array (self-supervised next-token prediction).
Source code in src/pitch_sequencing/models/hmm_model.py
predict_proba(X)
¶
Return emission probabilities for each sample given predicted state.