erdogant / bnlearn

Python library for learning the graphical structure of Bayesian networks, parameter learning, inference and sampling methods.
https://erdogant.github.io/bnlearn
Other
465 stars 46 forks source link

Hi Erdogant, I have some questions. #21

Closed erdogant closed 3 years ago

erdogant commented 3 years ago

Hi Erdogant, I have some questions.

  1. My class variable(result) contains YES and NO. I only need to generate NO data. What should I do?
  2. The last node of the DAG is the class variable. How do I specify the class variable(result)? DAG = bnlearn.structure_learning.fit(n_train_df) ->DAG = bnlearn.structure_learning.fit(n_train_df, class='result')

Originally posted by @timhuang1125 in https://github.com/erdogant/bnlearn/issues/18#issuecomment-787995563

erdogant commented 3 years ago

If you have a DAG and also the CPDs, you can generate data with the sampling function. See example over here: https://erdogant.github.io/bnlearn/pages/html/Sampling%20and%20datasets.html

You can then slice the data how you need it. In your case the samples from the NO class.