本文整理汇总了Python中hmmlearn.hmm.GaussianHMM._get_transmat方法的典型用法代码示例。如果您正苦于以下问题:Python GaussianHMM._get_transmat方法的具体用法?Python GaussianHMM._get_transmat怎么用?Python GaussianHMM._get_transmat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hmmlearn.hmm.GaussianHMM
的用法示例。
在下文中一共展示了GaussianHMM._get_transmat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GaussianHMM
# 需要导入模块: from hmmlearn.hmm import GaussianHMM [as 别名]
# 或者: from hmmlearn.hmm.GaussianHMM import _get_transmat [as 别名]
n_comps = 6
model = GaussianHMM(n_comps)
model.fit([new_x])
hidden_states = model.predict(new_x)
new_test = np.asarray(test_set)
predictions = []
chunk = train_set[2500:]
'''find prob for each test point, compare to expected, then re-fit HMM with it'''
for idx, x in enumerate(chunk):
_, pst_prob = model.score_samples([x])
max_ind = pst_prob.argmax()
trn = model._get_transmat()[max_ind]
'''Get the max one for now. Maybe use some other method later one'''
max_trn = trn.argmax()
cov = model._get_covars()[max_trn]
mns = model._get_means()[max_trn]
rd = np.random.multivariate_normal(mns, cov)
int_rd = [int(x) for x in rd]
predictions += [int_rd]
# retrain HMM with new data point
moving_idx = 30-idx
mov_train_set = []
if moving_idx < 1: