erdogant / bnlearn

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

fix 2 minor bugs #88

Closed ankh1999 closed 10 months ago

ankh1999 commented 10 months ago
  1. For bnlearn.py, fix bug in predict when variable has more than one state
  2. For learn_discrete_bayes_net.py, due to the limited precision of floating-point calculations in computers, a zero value may occur at line 172. This can lead to a ValueError: math domain error when calculating math.log at line 322 in subsequent computations. After researching for a solution, I have added a very small value (1e-10) at this point to perform smoothing. Now the program runs without any issues. If there are any issues with this approach, please let me know, and I will try to make modifications.