{
"metadata": {
"name": "",
"signature": "sha256:a8853793959f5ce6f907bcbb56e8ee55f8549a1c6a9d7c6b4263222eccb92a3b"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Today i want to talk about bayesian learning. Bayes' theorem has been around for a while. The name itself is after the statiscian Thomas Bayes. Interesting enough, He died before even published his major scientific achievement to the world as we know today.\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.display import Image"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Bayes found that in the event of probability event A, if depend on event B, then the probability of A will occurs in areas which B have to present.\n",
"\n",
"I'm not going to bogged into the basic here, but maybe some intuition with Bayes will be used later discussion.\n",
"\n",
"\n",
">NOTE: This is what i learn so far from Bayesian Learning at Udacity, Machine Learning, Supervised Learning\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Machine Learning is relatively new field in artificial inteligence.The discipline in this field taught us how teach machine to learn based on the data. In other words, from all the data we can infer what are the function to produce the output. We simply teach as a teacher. What are the problem, what are the solution. Then the learner, in this case the machine, learn how to induct from experience, the solution given future input .\n",
"\n",
"Bayesian Learning derrive from machine learning algorithm that implement Bayes to learning algorithm. This is our usual Bayes:\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Image(url='https://www.evernote.com/shard/s376/res/d587c056-ec5d-46f7-8d5f-870bf1adf80d/Screen%20Shot%202014-10-22%20at%202.29.31%20PM.jpg?resizeSmall&width=821')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
""
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": [
""
]
}
],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Bayesian Learning is calculate which are our most probable hypothesis in our hypothesis set, to act as a mapping function from our date to our labeled output.\n",
"\n",
"\n",
"Now how do we implement Bayes in machine Learning. Turns out the data directly correlated with our hypothesis. This is how we calculate the probability of our hypothesis given data. It depend on probability of data given hypothesis with our normalization term. This is only for particular hypothesis from our possible hypothesis.\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Image(url='https://www.evernote.com/shard/s376/res/4569bdad-ad84-4355-a8e2-efe9020b96c9')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
""
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 9,
"text": [
""
]
}
],
"prompt_number": 9
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In machine learning we present a tupple-pair, with input(x) and the label(d). To over simplify this learning, consider our samples are noise-free. There's no sensor error, human error, nature error, or any other kind of error.\n",
"\n",
"We also think that the target concept(The definite hypothesis for our problems) is in fact in our dataset.\n",
"\n",
"We also have uniform prior, where the the hypothesis in our hypothesis set is equally distributed. This is important as some people overlook this. We get to know that every hypothesis have same fighting chance.\n",
"\n",
"The probability of h in our H(hypothesis set), as it uniform distribution, then it will just be 1/|H|.\n",
"\n",
"Next our hypothesis is calculated 1 if our hypothesis get the same result as training output otherwise 0. This will make the probability of h gets higher if it more correct at predicting the output.\n",
"\n",
"Now since we have calculate all the probability of D given some particular h, we can calculate the probabability of D by accumulating the probability across the whole population of h. Well what it equals to? The probabability of hypothesis that only consistent with the data. If it doesn't, then it doesn't take into equation(as we filter that at P(D|h). that the probability in more spesific set, the version space(VS).\n",
"\n",
"Finally applying P(h|D) from Bayes Rule, we get the result. The result is no matter what the hypothesis are, we are choosing the hypothesis that fit the requirements, the hypothesis in the version space. So every hypothesis in the version space are fit to be THE hypothesis"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Image(url='https://www.evernote.com/shard/s376/res/148db25e-26a9-4492-bbba-893de4cc8e9e')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
""
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 10,
"text": [
""
]
}
],
"prompt_number": 10
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, eventhough that we learn how to calculate the most probable hypothesis, it's not the case that we choose alone that particular hypothesis. It may lead to that, but actually we calculating the predicting output by voting. Which are the hypothesis that can allow to vote? the hypothesis that only in the version space. From the example we know that the hypothesis with most probable, 0.4 have said positive. But, since the other two said -, then the predicting label for x is -"
]
}
],
"metadata": {}
}
]
}