Bayesian Networks: Fundamentals

Saurabh Kadam
Analytics Vidhya
Published in
4 min readNov 2, 2019

Bayesian Networks

I know they sound difficult and they are!

Yes that is right.Just keep your concepts clear.

<image courtesy from Google>

When I started statistics it was toughest chapter I have faced. Let us look into basic stuff first.

What is probability?

Probability is defined as

The quality or state of being probable; the extent to which something is likely to happen or be the case.

It is measure to calculate likelihood of the event in given sample spaces.

In Simple example of probability we can say by below formula

Prob(Event)=No of time event take place in sample space/Total number of sample space.

That cover specific coin example like tossing fair coin and getting head

Random Coin toss Twice

1 — In first toss we get probability for first toss: First toss give is ½ probability for both head and tail.

2 — In two sample spaces we get like (H,T): But second toss we get 4 sample spaces and we calculate probability vice versa. Which will be ¼ for two time coin toss.

When you plot sample spaces in tree diagram. It is called ‘Probability Tree’

Enough with probability for now.

Is it important to know probability while learning Bayesian networks?

Yes

Important thing though Probability trees play import role in Probabilistic Graphical Models when you started learning Bayesian Networks.It plays important role in computer vision and in field of genomics.

What is Probabilistic model?

Probabilistic model are the model which is implemented in tree structure in such way that you can measure the flow of probability in any node of point.This one is my definition for probability model.

Probablistic Model for Common Flu and Astronaut who visited space.

Probabilistic model shows conditions where each node is ‘state’ connected via link to another state. Each node has probability like if astronaut visited from Mars has same symptoms as the guy who suffering from common cold.

Probablility for each node W.R.T to state

For above network has probability for each node like ‘0’ is False and ‘1’ is for True Condition.

There are independent probability for the some states like visiting Mars.

We can see that probability is linked with each node.Every node is calculated with simple multiplication with each probability function.Let’s see one with example

We take one example from Probabilistic function to check chain rule for Bayesian network

Bayesian Model

Above example is says that there are independent states difficulty (based on Difficulty of exam) and other is intelligence(based on intellect). Based on difficulty and intelligence student get grade and according to grade that they get Letter for recommendation.

Probability of each node with dependent and independent nodes.

So each node has unique probability some depend on one node and some are independent.

Joint probability

Joint probability or dot product

For calculating joint probability of the function we just multiply all states probability. From this, we get the above formula. I am using the following symbols to represent the above states:

D: Difficulty

I: Intelligence

G: Grade

S: SAT

L: Letter

Now consider the case where you want probability for p(d1,i1,g2,s0,I1)

So just refer table

p(d1).p(i1).p(g2|d1,i1)..p(i1,g2).p(s0.I1)=0.6*0.3*0.3*0.6*0.2=0.00648

So you got probability for specific nodes with given states.

Don’t think so,we just barely touched the surface.

Just hit me up for more topics or queries like Bayesian topics like Reasoning pattern and Flows in
graphs.
Email:saurabhkdm721@gmail.com
Linkedin: https://www.linkedin.com/in/saurabh-kadam-853b577a/

Reference:Stanford Lecture notes.

--

--

Saurabh Kadam
Analytics Vidhya

Devops Professional by Job.Machine Learning ,Deep learning and 3D modelling for Hobby.