本文整理汇总了Python中msmbuilder.MSMLib.estimate_rate_matrix方法的典型用法代码示例。如果您正苦于以下问题:Python MSMLib.estimate_rate_matrix方法的具体用法?Python MSMLib.estimate_rate_matrix怎么用?Python MSMLib.estimate_rate_matrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msmbuilder.MSMLib
的用法示例。
在下文中一共展示了MSMLib.estimate_rate_matrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_estimate_rate_matrix_1
# 需要导入模块: from msmbuilder import MSMLib [as 别名]
# 或者: from msmbuilder.MSMLib import estimate_rate_matrix [as 别名]
def test_estimate_rate_matrix_1():
np.random.seed(42)
assignments = np.random.randint(2, size=(10, 10))
counts = MSMLib.get_count_matrix_from_assignments(assignments)
K = MSMLib.estimate_rate_matrix(counts, assignments).todense()
correct = np.matrix([[-40.40909091, 0.5], [0.33928571, -50.55357143]])
eq(K, correct)
示例2: pjoin
# 需要导入模块: from msmbuilder import MSMLib [as 别名]
# 或者: from msmbuilder.MSMLib import estimate_rate_matrix [as 别名]
ratemtx_fn = pjoin(args.outdir, "K.mtx")
tcounts_fn = pjoin(args.outdir, "tCounts.mtx")
unsym_fn = pjoin(args.outdir, "tCounts.UnSym.mtx")
mapping_fn = pjoin(args.outdir, "Mapping.dat")
fixed_fn = pjoin(args.outdir, "Assignments.Fixed.h5")
pops_fn = pjoin(args.outdir, "Populations.dat")
if not os.path.exists(args.outdir):
os.mkdir(args.outdir)
outlist = [ratemtx_fn, tcounts_fn, unsym_fn, fixed_fn, pops_fn]
for e in outlist:
arglib.die_if_path_exists(e)
# if lag time is not one, there's going to be a unit mispatch between
# what you get and what you're expecting.
lag_time = 1
counts, rev_counts, t_matrix, populations, mapping = MSMLib.build_msm(
assignments, lag_time=lag_time, symmetrize=args.symmetrize
)
K = MSMLib.estimate_rate_matrix(rev_counts, assignments)
np.savetxt(pops_fn, populations)
np.savetxt(mapping_fn, mapping, "%d")
scipy.io.mmwrite(ratemtx_fn, K)
scipy.io.mmwrite(tcounts_fn, rev_counts)
scipy.io.mmwrite(unsym_fn, counts)
Serializer.SaveData(fixed_fn, assignments)
for e in outlist:
logger.info("Saved %s" % e)