Maybe where u start reading this, you may ask, “who the hell is bayes???”, well, trust me, i don’t know him well either . As far as i know, he is the founding of bayesian theorem, one the basic “uncertainty” (sorry if i misspell it ) theorem in artificial intelligence.

I want start to find more about bayes when i took decision support system course. The most painful thing is i got “statistical method” categories in final project. I’m bad when dealing with math or statistic. It’s really sucks. Moreover, i didn’t have enough time at the beginning. So i let my team, tiwi(oh.. god, not again), hanna, rina, and denny from statistic to made first progress.

Presentation before the mid exam was made by denny. I didn’t get the point though, because he is using anava method (it’s really complicated shit). I’m really don’t get the idea of anava. I’m afraid that thing is inapplicable in our project.

Time for made the final project is nearer every day. Luckily, i have some extra time to made progress with bayes. After searching and searching, i found that the easiest thing is create application with naive bayes classifier.

Ok, what the hell is naive bayes classifier? I’ll try to make simple explanation. Bayesian theorem is theorem about probability. It’s the basic for naive bayes classifier. Well, probability is easy, say you have a coin (one side is head and tail is another), if you throw it once, what is the probability of showing head, and what is the probability of showing tail. Let see.. is it 50% chance? Yup, you’re right.

The idea of naive bayes classifier is using the probability of some independence event and calculate an event which is influenced by independence event. The most simple example (i think) is the probability of play-tennis or not-to-play-tennis. Let’s go straight into the sample.

Let say, you have some of data like this :

Day | Outlook | Temperature | Humidity | Wind | |

Day1 | Sunny | Hot | High | Weak | No |

Day2 | Sunny | Hot | High | Strong | No |

Day3 | Overcast | Hot | High | Weak | Yes |

Day4 | Rain | Mild | High | Weak | Yes |

Day5 | Rain | Cool | Normal | Weak | Yes |

Day6 | Rain | Cool | Normal | Strong | No |

Day7 | Overcast | Cool | Normal | Strong | Yes |

Day8 | Sunny | Mild | High | Weak | No |

Day9 | Sunny | Cool | Normal | Weak | Yes |

Day10 | Rain | Mild | Normal | Weak | Yes |

Day11 | Sunny | Mild | Normal | Strong | Yes |

Day12 | Overcast | Mild | High | Strong | Yes |

Day13 | Overcast | Hot | Normal | Weak | Yes |

Day14 | Rain | Mild | High | Strong | No |

Let see… just focus on first column, bout the outlook. Ok, now with that data, calculate, how much is the probability we play tennis in sunny day. Probability of playing tennis in sunny day is 2 / 9 = 2/9 = 22% chances. Remember, 9 obtained from total yes. We can also get the probability of rain-Yes, rain-No, etc.

Get the point? Ok, naive bayes is simple, we use that independence probability (rain-yes,rain-no,sunny-yes,sunny-no,etc) to calculate how much probability to play tennis or not. The good thing is, we don’t need every information, even partial data is enough to make a inference / decision.

This is how we calculate the probability of Play tennis = yes from data : Outlook = sunny, temperature = cool, and humidity = high. Ok, the probability for Sunny-Yes = 2/9, Sunny-No = 3/5, cool-Yes = 3/9, cool-No = 1/5, highHumid-Yes = 3/9 , highHumid-No = 4/5, Yes = 9/14 and No = 5/14.

Now we calculate the probability of play tennis.

p(PlayTennisYes) = p(Yes)*p(Sunny-Yes)*p(cool-Yes)*p(highHumid-Yes) / [(p(Yes)*p(Sunny-Yes)*p(cool-Yes)*p(highHumid-Yes)) + (p(No)*p(Sunny-No)*p(cool-No)*p(highHumid-No))]

Well, it’s hard to read, because i don’t understand LaTex though, sorry bout the equation, anyway, the simpler ways is the probability is yes*yes*yes / [(no*no*no) + (yes*yes*yes)].

The more advance use of bayesian theorem is bayesian network. In bayesian network, each probability is not independence, it’s depend on each other. Example is beach problem. How much people going to beach if not holiday? how much holiday depend on political situation, etc.

Well, that is naive bayes. I’ve made application with Delphi and MySQL as database. It’s application to decide whether someone is have the right to get the BLT(Cash Funding for the poor). You can download the source and the binary in here . I’m using suipack and Zeos Component, you can download it here [link dead]. You can also download my presentation. For the final report, right now, I’m working on it, so you can download immediately (Hey, i’m not the one who’s made the report, I just made application in one night). I hope you get something about bayes, because in artificial intelligence cource, i don’t get anything about bayes. Thanks for reading .

Links :

Naive Bayes@Wikipedia.org

Application source code

Components i used [link dead]

Thanks for your explanation, i’ts help me to understand what is Bayes Naive Algorithm

I Dont download the samples.

Mas, kok link downloadnya ngga ada?! ada link alternatif?

Hi guys.. sorry to say that the link is broken down, and I’ve lost the source also. I’ve tried to look at my old college files, but still can’t find it anywhere. Sorry guys