本文整理汇总了Python中msmbuilder.MSMLib.mle_reversible_count_matrix方法的典型用法代码示例。如果您正苦于以下问题:Python MSMLib.mle_reversible_count_matrix方法的具体用法?Python MSMLib.mle_reversible_count_matrix怎么用?Python MSMLib.mle_reversible_count_matrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msmbuilder.MSMLib
的用法示例。
在下文中一共展示了MSMLib.mle_reversible_count_matrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct_counts_matrix
# 需要导入模块: from msmbuilder import MSMLib [as 别名]
# 或者: from msmbuilder.MSMLib import mle_reversible_count_matrix [as 别名]
def construct_counts_matrix(assignments):
"""Build and return a counts matrix from assignments.
Symmetrize either with transpose or MLE based on the value of the
self.symmetrize variable
Also modifies the assignments file that you pass it to reflect ergodic
trimming
Parameters
----------
assignments : np.ndarray
2D array of MSMBuilder assignments
Returns
-------
counts : scipy.sparse.csr_matrix
transition counts
"""
n_states = np.max(assignments.flatten()) + 1
raw_counts = MSMLib.get_count_matrix_from_assignments(assignments, n_states,
lag_time=Project().lagtime,
sliding_window=True)
ergodic_counts = None
if Project().trim:
raise NotImplementedError(('Trimming is not yet supported because '
'we need to keep track of the mapping from trimmed to '
' untrimmed states for joint clustering to be right'))
try:
ergodic_counts, mapping = MSMLib.ergodic_trim(raw_counts)
MSMLib.apply_mapping_to_assignments(assignments, mapping)
counts = ergodic_counts
except Exception as e:
logger.warning("MSMLib.ergodic_trim failed with message '{0}'".format(e))
else:
logger.info("Ignoring ergodic trimming")
counts = raw_counts
if Project().symmetrize == 'transpose':
logger.debug('Transpose symmetrizing')
counts = counts + counts.T
elif Project().symmetrize == 'mle':
logger.debug('MLE symmetrizing')
counts = MSMLib.mle_reversible_count_matrix(counts)
elif Project().symmetrize == 'none' or (not Project().symmetrize):
logger.debug('Skipping symmetrization')
else:
raise ValueError("Could not understand symmetrization method: %s" % Project().symmetrize)
return counts
示例2: compare_kyle_to_lutz
# 需要导入模块: from msmbuilder import MSMLib [as 别名]
# 或者: from msmbuilder.MSMLib import mle_reversible_count_matrix [as 别名]
def compare_kyle_to_lutz(self, raw_counts):
"""Kyle wrote the most recent MLE code. We compare to the previous
code that was written by Lutz.
"""
counts = MSMLib.ergodic_trim(raw_counts)[0]
x_kyle = MSMLib.mle_reversible_count_matrix(counts)
x_kyle /= x_kyle.sum()
x_lutz = MSMLib.__mle_reversible_count_matrix_lutz__(counts)
x_lutz /= x_lutz.sum()
eq(x_kyle.toarray(), x_lutz.toarray())
示例3: compare_kyle_to_reference
# 需要导入模块: from msmbuilder import MSMLib [as 别名]
# 或者: from msmbuilder.MSMLib import mle_reversible_count_matrix [as 别名]
def compare_kyle_to_reference(self, raw_counts, reference):
"""Compare MLE estimated reversible counts to a reference matrix"""
counts = MSMLib.ergodic_trim(raw_counts)[0]
x_kyle = MSMLib.mle_reversible_count_matrix(counts)
eq(x_kyle.toarray(), reference.toarray())