hmmlearn的多项式(离散)发射中的符号而不是数字

时间:2018-09-23 15:36:18

标签: python hmmlearn

我想生成符号样本,而不是hmm.MultinomialHMM中的数字。

我的代码例如:

model = hmm.MultinomialHMM(n_components=2)
tr =np.array([[0.8, 0.2],
              [0.3, 0.7]])

model.n_features = 4

em = np.array([[0.3,0.7,0.0,0.0],
               [0.0,0.0,0.1,0.9]])
model.transmat_ = tr
model.emissionprob_=em
model.startprob_ = np.array([0.5,0.5])

#generate sample
symb, hid = model.sample(10)

所以symb

array([[1],
       [1],
       [3],
       [3],
       [3],
       [2],
       [3],
       [3],
       [1],
       [3]])

但是我需要设置一个符号

0 个答案:

没有答案