本文整理汇总了Python中sklearn.hmm.GaussianHMM._set_means方法的典型用法代码示例。如果您正苦于以下问题:Python GaussianHMM._set_means方法的具体用法?Python GaussianHMM._set_means怎么用?Python GaussianHMM._set_means使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.hmm.GaussianHMM
的用法示例。
在下文中一共展示了GaussianHMM._set_means方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GaussianHMM
# 需要导入模块: from sklearn.hmm import GaussianHMM [as 别名]
# 或者: from sklearn.hmm.GaussianHMM import _set_means [as 别名]
means = np.array([ [ 0.0, 0.0 ],
[ np.log1p(args.coverage), 0.0 ],
[ 0.0, np.log1p(args.coverage) ],
[ np.log1p(args.coverage/2), np.log1p(args.coverage/2) ],
[ np.log1p(args.coverage), np.log1p(args.coverage) ] ])
cv = 1.0
covars = np.array([ [ 0.01, 0.01 ],
[ cv, 0.01 ],
[ 0.01, cv ],
[ cv/2, cv/2 ],
[ cv, cv ] ])
hidden = [ "private" ] + ref_samples + [ "heterozygous","pseudohet" ]
hmm = GaussianHMM(n_components = len(means), random_state = rs)
hmm._set_means(means)
hmm._set_covars(covars)
## filter sites; compute observation sequence as log(1+count)
keep = np.logical_and((counts.max(1) < args.X_max*args.coverage), (counts.sum(1) > -1.0))
counts = counts[ keep,: ]
obs = np.log1p(counts)
starts = np.array([ start for start,end in ivls ]).reshape( (len(ivls), 1) )
starts = starts[ keep,: ]
## run hmm
states = hmm.decode(obs)
## print result to stdout
for i in range(0, counts.shape[0]):
print starts[i,0], obs[i,0], obs[i,1], hidden[ states[1][i] ]