Skip to main content

BAYESIAN NETWORKS in Machine Learning

So basically this topic is a mix of three theories namely:

  1. Graph Theory
  2. Probability Theory
  3. Bayes Theory

1. Graph Theory

 Graph theory is a mathematical field for the study of Graphs.

Graph = Nodes (or vertices) + Arcs (or lines, or edges!)

So a node can be anything that you want, a company, profits or a band.

The thing is- you can have many nodes- but they have to have some form of relation between them. Graphs can be directed and undirected as shown below.


2. Probability Theory

Probability is a measure of the likelihood of something happening. And is always a value between 0 and 1. The more likely, the closer the value is to 1 and vs-versa.

Probability = (Particular Event)➗(All Possible Events)

An example is coin flip. The probability of getting heads is 0.50 - and this brings us to our next idea, conditional probability.

Instead of one event at a time, what is the the probability of getting a heads twice? Which then becomes

P(Heads|Heads)

The '|' simply means 'given that' (the last value was). And as per our example is 0.50*0.50. You might ask- why multiply? Or what does multiply mean? Or cant we just add?  Well that's because we want to find the intersection of both H and H sets.

3. Bayes Theory

This is an extension of conditional probability. While using Bayes you are using conditional probability to calculate another one.

P(A|B) = P(B|A) * P(A)/P(B)

ie. Posterior = Likelihood*Prior/Evidence

If you want more i refer to this article.


For great examples, follow this link. 

Sample code : 

How AI can help fight Cholera. Feel free to contribute! https://goo.gl/kmcvKv


 


Comments

Popular posts from this blog

Making money with the falling rand: Lessons from Zimbabwe

It is no secret that the rand is falling like there is no tomorrow. This year alone it has fallen by over 18%. And if you look closely, at the last 3 years- it has fallen by 35%! This is not neglecting the economic setup where the slightest thing leads to ‘ toi toi. ' This trend of continuous striking and pay rate increase bargains has created such a vicious cycle. Prices rise, people strike, economy starts going through stuff. And we back at square one. We all know for sure that this cycle is bad. Zimbabwe and South Africa might not be different soon, only difference being that Zimbabwe chased the farmers, South Africa is chasing stabilisation. (Maybe the paradox of thrift  (prompted by the large population) will save them! Hope so.) In Zimbabwe 2008, a lot of people made a lot of money from ‘burning money’. This was whereby people took advantage of the bank rate versus the ‘streets’ rate of forex. The streets rate for forex was lower than the bank rate. Problem wa...

Gentlest introduction : The Cloud

How it began To me the concept of cloud started when people began virtualizing their systems using the like of Virtual-box and VMware. What bough this a;long was the evolution/advent of technology which made it possible for software so simulate hardware. Originally software could not simulate hardware drivers but the moment that became possible- virtualization was born. A few years after- companies started offering this virtualization at a much grander scale and Infrastructure as a service was born. Lets get down to the three cloud components namely: Infrastructure as a Service (IAAS) This outsourced hardware meaning that one noways noes not need to setup servers, air-con and the like of access control but could 'rent' from someone and one of the great things about this was that a backup not only meant software but also meant hardware (as software could now simulate hardware) so recovery in case of disaster became easier. Platform as a Service (PAAS) This is ...

Deploy Django app online for free!

So after a number of lines of code, brilliance and dreaming. Your next dream is for the world to see. Of course you can walk around with your computer and doing a 'manage.py runserver' But cumon guys, lets embrace the cloud. Not like this guy though! I choose to deploy on  PythonAnywhere . So you ask why? 1) Free amazing support - You actually talk to a live human ! 2) Easy - Very easy 3) Affordable - As you scale up, it gets way better! So by now I assume you are already on a version control system (So I will not waste much energy on that one). Maybe Ill someday write on my two favs  Github  and  Bitbucket . STEP 1: Create an account on pythonanywhere. Kindly note that your username will be included in your apps url. So it will be like : " yourUsername .pythonanywhere.com" STEP 2: Select other and set a bash console. STEP 3: Push your code from version control This will push from (in my example) github to your pythonanywhere. You...