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

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

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

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

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

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

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

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

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


当前回答

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

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

其他回答

正如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学习的要点是你应该使用不太复杂,但足够复杂(复杂性是算法可以适合的最大维度)的算法来适合你的数据。换句话说,使用奥卡姆剃刀。

算法的选择取决于场景和数据集的类型和大小。 还有很多其他因素。

这是一个简单的基础机器学习备忘单。

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

首先,你需要确定你的问题。这取决于您拥有的数据类型以及您想要的任务是什么。

如果你是预测类: 你有标签数据 您需要遵循分类方法及其算法 你没有标签数据 你需要使用集群方法 如果你在预测数量: 你需要使用回归方法 否则 你可以使用降维方法

上面提到的每种方法都有不同的算法。特定算法的选择取决于数据集的大小。

来源:http://scikit-learn.org/stable/tutorial/machine_learning_map/

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

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.