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


Python MarkovModel.fit方法代码示例

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


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

示例1: MarkovModel

# 需要导入模块: from pgmpy.models import MarkovModel [as 别名]
# 或者: from pgmpy.models.MarkovModel import fit [as 别名]
import numpy as np
import pandas as pd
from pgmpy.models import MarkovModel
from pgmpy.estimators import PseudoMomentMatchingEstimator
# Generating some random data
raw_data = np.random.randint(low=0, high=2, size=(100, 4))
raw_data
data = pd.DataFrame(raw_data, columns=['A', 'B', 'C', 'D'])
data

# Diamond shaped Markov Model as stated in Fig. 6.1
markov_model = MarkovModel([('A', 'B'), ('B', 'C'),
                            ('C', 'D'), ('D', 'A')])
markov_model.fit(data, estimator=PseudoMomentMatchingEstimator)
factors = coin_model.get_factors()
factors
开发者ID:xenron,项目名称:sandbox-da-python,代码行数:18,代码来源:B04016_06_03.py

示例2: MarkovModel

# 需要导入模块: from pgmpy.models import MarkovModel [as 别名]
# 或者: from pgmpy.models.MarkovModel import fit [as 别名]
import numpy as np
import pandas as pd
from pgmpy.models import MarkovModel
from pgmpy.estimators import MaximumLikelihoodEstimator
# Generating some random data
raw_data = np.random.randint(low=0, high=2, size=(100, 2))
raw_data
data = pd.DataFrame(raw_data, columns=['A', 'B'])
data

# Markov Model as stated in Fig. 6.5
markov_model = MarkovModel([('A', 'B')])
markov_model.fit(data, estimator=MaximumLikelihoodEstimator)
factors = coin_model.get_factors()
print(factors[0])
开发者ID:xenron,项目名称:sandbox-da-python,代码行数:17,代码来源:B04016_06_02.py

示例3: MarkovModel

# 需要导入模块: from pgmpy.models import MarkovModel [as 别名]
# 或者: from pgmpy.models.MarkovModel import fit [as 别名]
import numpy as np
import pandas as pd
from pgmpy.models import MarkovModel
from pgmpy.estimators import BayesianEstimator
# Generating random data
raw_data = np.random.randint(low=0, high=2, size=(1000, 2))
data = pd.DataFrame(raw_data, columns=['X', 'Y'])
model = MarkovModel()
model.fit(data, estimator=BayesianEstimator)
model.get_factors()
model.get_nodes()
model.get_edges()
开发者ID:xenron,项目名称:sandbox-da-python,代码行数:14,代码来源:B04016_06_05.py


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