假设我在处理一些分类问题。(欺诈检测和评论垃圾邮件是我目前正在处理的两个问题,但我对一般的分类任务很好奇。)

我如何知道我应该使用哪个分类器?

决策树 支持向量机 贝叶斯 神经网络 再邻居 q学习的 遗传算法 马尔可夫决策过程 卷积神经网络 线性回归或逻辑回归 提升,装袋,取样 随机爬坡或模拟退火 ...

在哪些情况下,其中一个是“自然的”第一选择,选择它的原则是什么?

我正在寻找的答案类型的例子(来自Manning等人的信息检索介绍书):

a.如果你的数据被标记了,但你只有有限的数量,你应该使用高偏差的分类器(例如,朴素贝叶斯)。

我猜这是因为高偏差分类器会有更低的方差,这是很好的,因为数据量小。

b.如果你有大量的数据,那么分类器真的不那么重要,所以你可能应该选择一个具有良好可扩展性的分类器。

其他指导方针是什么?甚至像“如果你必须向一些高层管理人员解释你的模型,那么也许你应该使用决策树,因为决策规则是相当透明的”这样的回答也是很好的。不过,我不太关心实现/库问题。 另外,对于一个有点独立的问题,除了标准的贝叶斯分类器,是否有“标准的最先进的”方法来检测评论垃圾邮件(而不是电子邮件垃圾邮件)?


当前回答

Sam Roweis曾经说过,你应该先尝试朴素贝叶斯,逻辑回归,k近邻和Fisher线性判别。

其他回答

我的看法是,你总是首先运行基本的分类器来了解你的数据。通常情况下(至少在我的经验中),他们已经足够好了。

所以,如果你有监督数据,训练朴素贝叶斯分类器。如果有无监督数据,可以尝试k-均值聚类。

另一个资源是斯坦福机器学习系列视频中的一个讲座视频,我之前看过。在视频4或5中,我认为,讲师讨论了训练分类器时的一些普遍接受的惯例,优点/权衡等。

您应该始终考虑推断与预测之间的权衡。

如果你想了解数据中发生的复杂关系,那么你应该使用丰富的推理算法(例如线性回归或套索)。另一方面,如果你只对结果感兴趣,你可以使用高维和更复杂(但更难以解释)的算法,比如神经网络。

在选择使用哪种算法时,你可能会考虑的事情包括:

Do you need to train incrementally (as opposed to batched)? If you need to update your classifier with new data frequently (or you have tons of data), you'll probably want to use Bayesian. Neural nets and SVM need to work on the training data in one go. Is your data composed of categorical only, or numeric only, or both? I think Bayesian works best with categorical/binomial data. Decision trees can't predict numerical values. Does you or your audience need to understand how the classifier works? Use Bayesian or decision trees, since these can be easily explained to most people. Neural networks and SVM are "black boxes" in the sense that you can't really see how they are classifying data. How much classification speed do you need? SVM's are fast when it comes to classifying since they only need to determine which side of the "line" your data is on. Decision trees can be slow especially when they're complex (e.g. lots of branches). Complexity. Neural nets and SVMs can handle complex non-linear classification.

《OpenCV》这本书有两页在462-463页。在亚马逊预览版中搜索“有区别的”(可能也有谷歌本书),就能看到相关的页面。这两页是我在这本书中发现的最珍贵的宝石。

简而言之:

增强——当有大量可用的训练数据时通常是有效的。 随机树-通常非常有效,也可以执行回归。 k近邻-你能做的最简单的事情,通常有效但缓慢,需要大量内存。 神经网络——训练速度慢,但运行速度很快,仍然是字母识别的最佳表现。 SVM -在数据有限的情况下是最好的,但只有在大数据集可用时才会输给增强或随机树。

正如Andrew Ng教授经常说的那样:总是从实现一个粗糙的、肮脏的算法开始,然后迭代地完善它。

For classification, Naive Bayes is a good starter, as it has good performances, is highly scalable and can adapt to almost any kind of classification task. Also 1NN (K-Nearest Neighbours with only 1 neighbour) is a no-hassle best fit algorithm (because the data will be the model, and thus you don't have to care about the dimensionality fit of your decision boundary), the only issue is the computation cost (quadratic because you need to compute the distance matrix, so it may not be a good fit for high dimensional data).

Another good starter algorithm is the Random Forests (composed of decision trees), this is highly scalable to any number of dimensions and has generally quite acceptable performances. Then finally, there are genetic algorithms, which scale admirably well to any dimension and any data with minimal knowledge of the data itself, with the most minimal and simplest implementation being the microbial genetic algorithm (only one line of C code! by Inman Harvey in 1996), and one of the most complex being CMA-ES and MOGA/e-MOEA.

记住,通常情况下,在真正尝试算法之前,你无法真正知道什么对你的数据最有效。

作为一个边注,如果你想要一个理论框架来测试给定问题的假设和算法的理论性能,你可以使用PAC(可能大致正确)学习框架(注意:它非常抽象和复杂!),但总的来说,PAC学习的要点是你应该使用不太复杂,但足够复杂(复杂性是算法可以适合的最大维度)的算法来适合你的数据。换句话说,使用奥卡姆剃刀。