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


Python MarkovStateModel.transform方法代码示例

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


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

示例1: test_transform

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

    v = model.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.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.transform([['a', 'b', 'c', 'd']], 'fill')
    assert isinstance(v, list)
    assert len(v) == 1
    assert v[0].dtype == np.float
    np.testing.assert_array_equal(v[0], [0, 1, 2, np.nan])

    v = model.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: fit_msms

# 需要导入模块: from msmbuilder.msm import MarkovStateModel [as 别名]
# 或者: from msmbuilder.msm.MarkovStateModel import transform [as 别名]
def fit_msms(yaml_file):
    mdl_params = yaml_file["mdl_params"]

    current_mdl_params={}
    for i in mdl_params.keys():
        if i.startswith("msm__"):
            current_mdl_params[i.split("msm__")[1]] = mdl_params[i]


    for protein in yaml_file["protein_list"]:
        with enter_protein_mdl_dir(yaml_file, protein):
            print(protein)
            assignments = verboseload("assignments.pkl")
            msm_mdl = MarkovStateModel(**current_mdl_params).fit(
                [assignments[i] for i in assignments.keys()])
            verbosedump(msm_mdl, "msm_mdl.pkl")
            fixed_assignments = {}
            for i in assignments.keys():
                fixed_assignments[i] = msm_mdl.transform(
                    assignments[i], mode='fill')[0]
            verbosedump(fixed_assignments, 'fixed_assignments.pkl')
    return
开发者ID:sonyahanson,项目名称:kinase_msm,代码行数:24,代码来源:fit_transform_kinase_series.py


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