当前位置: 首页>>代码示例>>Python>>正文


Python MarkovStateModel.partial_transform方法代码示例

本文整理汇总了Python中msmbuilder.msm.MarkovStateModel.partial_transform方法的典型用法代码示例。如果您正苦于以下问题:Python MarkovStateModel.partial_transform方法的具体用法?Python MarkovStateModel.partial_transform怎么用?Python MarkovStateModel.partial_transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在msmbuilder.msm.MarkovStateModel的用法示例。


在下文中一共展示了MarkovStateModel.partial_transform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_partial_transform

# 需要导入模块: from msmbuilder.msm import MarkovStateModel [as 别名]
# 或者: from msmbuilder.msm.MarkovStateModel import partial_transform [as 别名]
def test_partial_transform():
    model = MarkovStateModel()
    model.fit([['a', 'a', 'b', 'b', 'c', 'c', 'a', 'a']])
    assert model.mapping_ == {'a': 0, 'b': 1, 'c': 2}

    v = model.partial_transform(['a', 'b', 'c'])
    assert isinstance(v, list)
    assert len(v) == 1
    assert v[0].dtype == np.int
    np.testing.assert_array_equal(v[0], [0, 1, 2])

    v = model.partial_transform(['a', 'b', 'c', 'd'], 'clip')
    assert isinstance(v, list)
    assert len(v) == 1
    assert v[0].dtype == np.int
    np.testing.assert_array_equal(v[0], [0, 1, 2])

    v = model.partial_transform(['a', 'b', 'c', 'd'], 'fill')
    assert isinstance(v, np.ndarray)
    assert len(v) == 4
    assert v.dtype == np.float
    np.testing.assert_array_equal(v, [0, 1, 2, np.nan])

    v = model.partial_transform(['a', 'a', 'SPLIT', 'b', 'b', 'b'], 'clip')
    assert isinstance(v, list)
    assert len(v) == 2
    assert v[0].dtype == np.int
    assert v[1].dtype == np.int
    np.testing.assert_array_equal(v[0], [0, 0])
    np.testing.assert_array_equal(v[1], [1, 1, 1])
开发者ID:Eigenstate,项目名称:msmbuilder,代码行数:32,代码来源:test_msm.py

示例2: load_trajs

# 需要导入模块: from msmbuilder.msm import MarkovStateModel [as 别名]
# 或者: from msmbuilder.msm.MarkovStateModel import partial_transform [as 别名]
"""Make a microstate MSM

{{header}}
"""

from msmbuilder.io import load_trajs, save_trajs, save_generic
from msmbuilder.msm import MarkovStateModel

## Load
meta, ktrajs = load_trajs('ktrajs')

## Fit
msm = MarkovStateModel(lag_time=2, n_timescales=10, verbose=False)
msm.fit(list(ktrajs.values()))

## Transform
microktrajs = {}
for k, v in ktrajs.items():
    microktrajs[k] = msm.partial_transform(v)

## Save
print(msm.summarize())
save_generic(msm, 'msm.pickl')
save_trajs(microktrajs, 'microktrajs', meta)
开发者ID:Eigenstate,项目名称:msmbuilder,代码行数:26,代码来源:microstate.py


注:本文中的msmbuilder.msm.MarkovStateModel.partial_transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。