Chengwei LEI, Ph.D.    Associate Professor

Department of Computer and Electrical Engineering and Computer Science
California State University, Bakersfield

 

Data Science

 

Bayesian Network

 



 

Probability Basics

 



The box of dice:

  • 99% fair, 1% loaded (50% at six)
  • randomly pick a die and roll
  • If we get 3 six in a row, what’s the chance that the die is loaded?
  • If we get 5 six in a row, what’s the chance that the die is loaded?

Bayes Theorem

 

Am I dying ?:

  • There is a rare deadly disease is present in the population at 1 in 100,000
  • A test for this disease will report positive for 99.5% of people with disease, and negative 99.9% of time for those without.
  • One day, I took this test, and got a Postivite result. Am I dying?

Bayes Disease

 



 

Naive Bayes Classification

 



 

 Bayesian Network

A Bayesian network (also known as a Bayes network, Bayes net, belief network, or decision network) is a probabilistic graphical model that represents a set of variables and their conditional dependencies via a directed acyclic graph (DAG).

 

 

It is used to handle uncertainty and make predictions or decisions based on probabilities.

* Graphical Representation:
Variables are represented as nodes in a directed acyclic graph (DAG), and their dependencies are shown as edges.
* Conditional Probabilities:
Each node’s probability depends on its parent nodes, expressed as P(Variable | Parent).
* Probabilistic Model:
Built from probability distributions, BNs apply probability theory for tasks like prediction and anomaly detection.

 

 



Here is one example:

with this probability table

How to calculate the probability of "Burglary is T, Fire is F, Alarm is F, Person1 is F, Person2 is T" ?

 

 

 





 

 

 

Medical Diagnosis example:

Try to build the Bayesian Network for this  case.

 

 

 

 






 

 

Asthma example :

 

Here is a dataset related to Asthma.

The information includes: "sex age urbanization education geographic_area allergy smoke sedentary asthma"

Based on your best knowledge, construct a Bayesian Network based on this dataset.

 


 

Assume that we are building an Expert System from scratch.

Build several/a DAG based on your knowledge.

Start from no patient.
Make prediction for next patient based on your Bayesian Network.
Use the new patient's information to update your Bayesian Network, and predict next patient.
Keep track of your BNs' performance, until all the patients are included.