本文整理汇总了Python中msmbuilder.MSMLib.trim_states方法的典型用法代码示例。如果您正苦于以下问题:Python MSMLib.trim_states方法的具体用法?Python MSMLib.trim_states怎么用?Python MSMLib.trim_states使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msmbuilder.MSMLib
的用法示例。
在下文中一共展示了MSMLib.trim_states方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_trim_states
# 需要导入模块: from msmbuilder import MSMLib [as 别名]
# 或者: from msmbuilder.MSMLib import trim_states [as 别名]
def test_trim_states():
# run the (just tested) ergodic trim
counts = scipy.sparse.csr_matrix(np.matrix('2 1 0; 1 2 0; 0 0 1'))
trimmed, mapping = MSMLib.ergodic_trim(counts)
# now try the segmented method
states_to_trim = MSMLib.ergodic_trim_indices(counts)
trimmed_counts = MSMLib.trim_states(
states_to_trim, counts, assignments=None)
eq(trimmed.todense(), trimmed_counts.todense())
assignments = np.array([np.arange(counts.shape[0])])
states_to_trim = MSMLib.ergodic_trim_indices(counts)
trimmed_counts, trimmed_assignments = MSMLib.trim_states(states_to_trim, counts, assignments=assignments) # Test that code works with assignments given
trimmed_assignments_ref = np.array([[0, 1, -1]]) # State 2 is strong-disconnected so set to -1
eq(trimmed_assignments, trimmed_assignments_ref)
示例2: test_trim_states
# 需要导入模块: from msmbuilder import MSMLib [as 别名]
# 或者: from msmbuilder.MSMLib import trim_states [as 别名]
def test_trim_states():
# run the (just tested) ergodic trim
counts = scipy.sparse.csr_matrix(np.matrix('2 1 0; 1 2 0; 0 0 1'))
trimmed, mapping = MSMLib.ergodic_trim(counts)
# now try the segmented method
states_to_trim = MSMLib.ergodic_trim_indices(counts)
trimmed_counts = MSMLib.trim_states(states_to_trim, counts, assignments=None)
eq(trimmed.todense(), trimmed_counts.todense())