pyhctsa.operations.model_fit.hmm_compare_n_states¶
-
pyhctsa.operations.model_fit.hmm_compare_n_states(y, train_p=
0.6, n_states=(2, 3, 4))¶ How the fit of hidden Markov models to the series changes with the number of hidden states.
Fits Gaussian hidden Markov models (HMMs) with different numbers of states to the first
train_pproportion of the time series (each with at most 30 cycles of EM), and compares the resulting log-likelihoods per sample on the training part and on the held-out remainder (hctsa’sMF_hmm_CompareNStates). Each model is fitted deterministically, by the best of six fixed starting points with a floor on the shared variance (_gaussian_hmm_fit(), as inhmm_fit()).- Parameters:¶
- Returns:¶
meanLLtrain,maxLLtrain: mean and maximum across models of the log-likelihood per sample of the training part (under each fitted model),meanLLtest,maxLLtest: the same on the test part,chLLtrain,chLLtest: change in training and test log-likelihood per sample from the model with the fewest states to the one with the most,meandiffLLtt: mean across models of the absolute difference between the test and training log-likelihoods per sample,LLtestdiff1,LLtestdiff2, …: change in test log-likelihood per sample from the i-th to the (i+1)-th number of states inn_states.
NaN if the series is too short to train on.
- Return type:¶
dict