首页 > 解决方案 > 贝叶斯网络结构学习的数据集

问题描述

经过大量研究,我没有找到包含必要材料的存储库来测试能够学习贝叶斯网络结构的算法。我需要的只有两件事:

我的算法应该能够从数据集中学习结构,然后我可以检查它离正确的 BN 有多远。你有任何链接吗?我已经找到了一些没有原始 BN 的数据集,反之亦然,但我的大学项目都需要它们。

提前致谢

PS:如果你有兴趣,我在我的项目中使用 Python。

标签: machine-learningdatasetbayesian-networks

解决方案


试试bnlearn 库。它包含结构学习参数学习推理和各种示例数据集,如喷水器、亚洲、警报等等。

  • 可以在此处找到各种示例。
  • 关于检测因果关系的博客可以在这里找到。

结构学习和推理示例:

# Load library
import bnlearn as bn

# Load Asia DAG
DAG = bn.import_DAG('asia')

# plot ground truth    
G = bn.plot(DAG)

# Sampling
df = bn.sampling(DAG, n=10000)

# Structure learning
model_sl = bn.structure_learning.fit(df, methodtype='hc', scoretype='bic')

# Plot based on structure learning of sampled data
bn.plot(model_sl, pos=G['pos'], interactive=True)

# Compare networks and make plot
# bn.compare_networks(model, model_sl, pos=G['pos'])

推荐阅读