我试图在python中使用hmmlearn来拟合隐马尔可夫模型。我假设我的数据没有被正确的格式化,但是这些文档对于hmmlearn来说是很轻的。直观地,我会将数据格式化为n_observations x n_time_points x n_features的三维数组,但是hmmlearn似乎想要一个2d数组。
import numpy as np
from hmmlearn import hmm
X = np.random.rand(10,5,3)
clf = hmm.GaussianHMM(n_components=3, n_iter=10)
clf.fit(X)
这将产生以下错误:
Val
这就是我的问题,我正在尝试用hmmlearn教授隐马尔可夫模型。我刚接触这门语言,在理解列表和数组之间的区别时遇到了一些困难。下面是我的代码:
from hmmlearn import hmm
from babel import lists
import numpy as np
import unidecode as u
from numpy import char
l = []
data = []
gods_egypt = ["Amon","Anat","Anouket","Anubis","Apis",
我现在正在尝试为一个多标签文本分类问题建立一个分类模型。
我有一个包含已清理文本列表的训练集X_train,例如
["I am constructing Markov chains with to states and inferring
transition probabilities empirically by simply counting how many
times I saw each transition in my raw data",
"I know the chips only of the players of my table