我相信我理解HMM的核心 . 通过HMM,我们解决了评估(发射的seq的概率),解码(最可能隐藏的seq)和学习问题(从观察到的发射序列seq中学习转换和发射概率矩阵) .

我的问题与学习问题有关 . 我有发射序列但是我也有每个序列的相关特征(意味着隐藏状态值,但隐藏状态的数量是未知的) . 在HMM的学习问题中,我们估计隐藏序列(大小和概率矩阵),并且为此我们只需要发射序列(如果事先不知道则可以优化隐藏序列的大小) .

我正在使用HMM library进行计算 . 当然,它没有我想要的选项 .

import numpy as np
import pandas as pd

from hmmlearn import hmm

filenames =  [f for f in os.listdir(dir_path) if '.csv' in f.lower()]
d1 = pd.read_csv(dir_path + filenames[0]).as_matrix() # Shape = [m, 3] => first two column is featute and last is the emission-state 
d2 = pd.read_csv(dir_path + filenames[1]).as_matrix() # Shape = [m, 3]


##
remodel = hmm.GaussianHMM(n_components=4, covariance_type="full", n_iter=100)

remodel.fit(d1[:, 0:2])  # Problem would have been solved if there was supervised option to pass the states as well 

pred_1 = remodel.predict(d1[:, 0:2])
true_1 = d1[:, -1] # Last column is state of the feature in 1, 2 column.

pred_2 = remodel.predict(d2[:, 0:2])
true_2 = d2[:, -1]

有没有办法在HMM中进行有监督的学习,如果是,那么如何?如果没有,那么我仍然可以使用HMM解决我的问题吗?如果有可能那么如何?