erdogant / bnlearn

Python package for Causal Discovery by learning the graphical structure of Bayesian networks. Structure Learning, Parameter Learning, Inferences, Sampling methods.
https://erdogant.github.io/bnlearn
Other
476 stars 46 forks source link

Implemented Structure Learning Algos #16

Closed arainboldt closed 3 years ago

arainboldt commented 3 years ago

Hello,

Great package! I'm just getting into exploring the API and was curious if the Chow Liu algorithm is implemented in the structure learning module under a different name. If not, any plans to implement it?

Thanks!

Andrew

erdogant commented 3 years ago

Thanks! The Chow Liu algorithm is great! It was not included yet. But I directly implemented into bnlearn! happy coding!

Update latest version with:

pip install -U bnlearn
import bnlearn
bnlearn.__version__ # should be 0.3.12

Example:

import bnlearn as bn
DAG = bn.import_DAG('sprinkler', verbose=0)
df = bn.sampling(DAG, n=1000, verbose=0)
model = bn.structure_learning.fit(df, methodtype='chow-liu', root_node='Wet_Grass')
G = bn.plot(model)
arainboldt commented 3 years ago

Thanks a lot for your quick response and implementing this! Awesome!