朴素贝叶斯分类的简单解释 [英] A simple explanation of Naive Bayes Classification

查看:250
本文介绍了朴素贝叶斯分类的简单解释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现很难理解朴素贝叶斯的过程中,我在想,如果有人能与推进的过程中英语简单的一步解释它。我的理解是需要通过时间的比较发生的概率,但我不知道训练数据是如何与实际的数据集。

请给我什么样的作用训练集剧本的解释。我给一个很简单的例子在这里的水果,如香蕉例如:

 训练集---
一轮红
圆橙色
椭圆形黄色
一轮红

数据集----
一轮红
圆橙色
一轮红
圆橙色
椭圆形黄色
一轮红
圆橙色
椭圆形黄色
椭圆形黄色
一轮红
 

解决方案

你的问题我的理解分为两个部分。一个是你需要的朴素贝叶斯分类器和功放多一些理解;第二个是围绕训练集的混乱。

在一般所有的机器学习算法的需要进行培训,监督学习任务,如分类,prediction等,或者像集群无监督的学习任务。

通过训练就意味着训练他们对特定的输入,因此稍后我们可以测试他们对未知输入(他们从来没有见过),为此,他们可能会进行分类或predict等(在监督学习)根据他们的学习。这是最像神经网络,SVM,贝叶斯等机器学习技术是基于。

因此​​,在一般的机器学习项目基本上你必须分配你的输入设置为开发集(训练集+开发,测试装置)及测试集(或评价集)。记住你的基本目标将是你的系统学习和他们设置或从未见过的无论是在开发新的投入分类测试集。

该测试装置通常具有相同的格式作为训练集。然而,该测试仪可以从训练语料库不同的是很重要的:如果我们简单地 再利用训练集作为测试集,然后一个模型,只需记住它的输入,无需学习如何推广到新的例子,将获得误导性高分。

在一般情况下,对于一个实例,70%,可训练集的情况。还记得随机划分训练和测试集。

现在我来给你关于朴素贝叶斯等问题。

来源例如下面:<一href="http://www.statsoft.com/textbook/naive-bayes-classifier">http://www.statsoft.com/textbook/naive-bayes-classifier

要表现出朴素贝叶斯分类的概念,可以考虑如下的例子:

如图所示,对象可以分为绿色红色。我们的任务是划分新发病例为他们到达时,即决定他们所属的类别标签,基于当前退出的对象。

由于有两倍多的绿色对象为红色,可以合理地认为,一个新的案例(还没有被观测到过)的两倍,可能有成员绿色,而不是红色。在贝叶斯分析,这种信念是被称为先验概率。先验概率是基于previous经验,在这种情况下绿色红色目的,并且经常的百分比使用predict结果才真正发生。

因此​​,我们可以这样写:

先验概率绿色 绿色物体数量/对象总数

先验概率红色 红色物体数量/对象总数

由于一共是 60 对象, 40 这是绿色 20 红色,我们的先验概率等级的成员资格是:

先验概率为绿色 六十分之四十○

先验概率为红色 六十○分之二十零

已经制定了我们的先验概率,我们现在已经准备好一个新的对象(圈如下图)分类。由于对象都能很好集群,这是合理的假设更为绿色(或红色)附近对象的X,越有可能是新的情况下,属于该特定颜色。为了测量这种可能性,我们得出绕X轴一圈其中包括点的数量(被选为先验)不论其阶级的标签。然后我们计算属于每个类别标签的圆点数。由此,我们计算出的可能性:

从上面的图中,很显然, X 绿色的可能性比<$的可能性较小C $ C> X 给红色,因为圈包括 1 绿色对象和 3 红色的。因此:

尽管先验概率表明, X 可能属于绿色(因为有两倍多的绿色红色)的可能性另有说明;该 X 的类成员为红色(因为有更多的红色 X 的附近的物体比绿色)。在贝叶斯分析,最终的分类是通过组合的信息,即这两个来源产生,现有和的可能性,采用了所谓的贝叶斯规则(修订版托马斯贝叶斯1702年至1761年的名字命名的),以形成一个后验概率。

最后,我们分类X作为红色,因为它的类成员达到最大的后验概率。

I am finding it hard to understand the process of Naive Bayes, and I was wondering if someone could explained it with a simple step by step process in English. I understand it takes comparisons by times occurred as a probability, but I have no idea how the training data is related to the actual dataset.

Please give me an explanation of what role the training set plays. I am giving a very simple example for fruits here, like banana for example

training set---
round-red
round-orange
oblong-yellow
round-red

dataset----
round-red
round-orange
round-red
round-orange
oblong-yellow
round-red
round-orange
oblong-yellow
oblong-yellow
round-red

解决方案

Your question as I understand is divided in two parts. One being you need more understanding for Naive Bayes classifier & second being the confusion surrounding Training set.

In general all of Machine Learning Algorithms need to be trained for supervised learning tasks like classification, prediction etc. or for unsupervised learning tasks like clustering.

By training it means to train them on particular inputs so that later on we may test them for unknown inputs (which they have never seen before) for which they may classify or predict etc (in case of supervised learning) based on their learning. This is what most of the Machine Learning techniques like Neural Networks, SVM, Bayesian etc. are based upon.

So in a general Machine Learning project basically you have to divide your input set to a Development Set (Training Set + Dev-Test Set) & a Test Set (or Evaluation set). Remember your basic objective would be that your system learns and classifies new inputs which they have never seen before in either Dev set or test set.

The test set typically has the same format as the training set. However, it is very important that the test set be distinct from the training corpus: if we simply reused the training set as the test set, then a model that simply memorized its input, without learning how to generalize to new examples, would receive misleadingly high scores.

In general, for an example, 70% can be training set cases. Also remember randomly partitioning the training and test sets.

Now I come to your other question about Naive Bayes.

Source for example below: http://www.statsoft.com/textbook/naive-bayes-classifier

To demonstrate the concept of Naïve Bayes Classification, consider the example given below:

As indicated, the objects can be classified as either GREEN or RED. Our task is to classify new cases as they arrive, i.e., decide to which class label they belong, based on the currently exiting objects.

Since there are twice as many GREEN objects as RED, it is reasonable to believe that a new case (which hasn't been observed yet) is twice as likely to have membership GREEN rather than RED. In the Bayesian analysis, this belief is known as the prior probability. Prior probabilities are based on previous experience, in this case the percentage of GREEN and RED objects, and often used to predict outcomes before they actually happen.

Thus, we can write:

Prior Probability of GREEN: number of GREEN objects / total number of objects

Prior Probability of RED: number of RED objects / total number of objects

Since there is a total of 60 objects, 40 of which are GREEN and 20 RED, our prior probabilities for class membership are:

Prior Probability for GREEN: 40 / 60

Prior Probability for RED: 20 / 60

Having formulated our prior probability, we are now ready to classify a new object (WHITE circle in the diagram below). Since the objects are well clustered, it is reasonable to assume that the more GREEN (or RED) objects in the vicinity of X, the more likely that the new cases belong to that particular color. To measure this likelihood, we draw a circle around X which encompasses a number (to be chosen a priori) of points irrespective of their class labels. Then we calculate the number of points in the circle belonging to each class label. From this we calculate the likelihood:

From the illustration above, it is clear that Likelihood of X given GREEN is smaller than Likelihood of X given RED, since the circle encompasses 1 GREEN object and 3 RED ones. Thus:

Although the prior probabilities indicate that X may belong to GREEN (given that there are twice as many GREEN compared to RED) the likelihood indicates otherwise; that the class membership of X is RED (given that there are more RED objects in the vicinity of X than GREEN). In the Bayesian analysis, the final classification is produced by combining both sources of information, i.e., the prior and the likelihood, to form a posterior probability using the so-called Bayes' rule (named after Rev. Thomas Bayes 1702-1761).

Finally, we classify X as RED since its class membership achieves the largest posterior probability.

这篇关于朴素贝叶斯分类的简单解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆