Reputation: 69
After tons of researches, I didn't find a repository with the necessary material to test a algorithm able to learn the structure of a Bayesian Network. What I need are only 2 things:
My algorithm should be able to learn the structure from the dataset and then I could check how far from the right BN it is. Do you have any links? I've already found some dataset without the original BN and viceversa but I need both of them for my university project.
Thanks in advance
PS: if you are interested, I use Python for my project.
Upvotes: 1
Views: 1339
Reputation: 1694
Try the bnlearn library. It contains structure learning, parameter learning, inference and various example datasets such as sprinkler, asia, alarm, and many more.
Example for structure learning and making inferences:
# 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'])
Upvotes: 1