首页 > > 详细

this lab session we try out Bayesian (belief) network

  this lab session we try out Bayesian (belief) network. While sklearn package already support Naïve Bayes classifier, we also need bnlearn, a Python package for learning the graphical structure of Bayesian networks, parameter learning, inference and sampling methods. Our main focus in this session is to test some of the Bayesian models.

 
 
adoption.csv            [ <=>                ]   8.84K  --.-KB/s    in 0s      
 
2022-04-05 19:36:22 (56.2 MB/s) - ‘adoption.csv’ saved [9048]
 
Testing the Naïve Bayes classifier is relatively simply, as it is straightforward to use the sklearn package.
 
Based on the conditional probability, we could predict the outcome using the trained Bayesian classifier. The choice is between a holdout we performed or a cross validation which is more often used in practice.
Below is a utility function we adopt to later summarize and plot the Bayesian inference outcome.
Compared to a regression result of “frequentist” approach, instead of a point estimate, we obtain a “region” of estimations, and summarize the regression results over multiple runs using the “peak” of the slope. Since the coefficients reported in different runs are still in a bell-shaped curve, most likely we could adopt this way of taking the summary statistics.
联系我们 - QQ: 99515681 微信:codinghelp
© 2021 www.7daixie.com
程序辅导网!