如何选择机器学习算法

决策树: 易于解释说明(对于某些人来说 —— 我不确定我是否在这其中)。它可以毫无压力地处理特征间的交互关系并且是非参数化的,因此你不必担心异常值或者数据是否线性可分(举个例子,决策树能轻松处理好类别A在某个 特征维度x的末端 ,类别B在中间,然后类别A又出现在特征维度x前端的情况 )。它的一个缺点就是不支持在线学习,于是在新样本到来后,决策树需要全部重建。另一个缺点是容易过拟合,但这也就是诸如随机森林(或提升树)之类的集成方法的切入点。另外,随机森林经常是很多分类问题的赢家(通常比支持向量机好上那么一点,我认为),它快速并且可调,同时你无须担心要像支持向量机那样调一大堆参数,所以最近它貌似相当受欢迎。

Advantages of SVMs: High accuracy, nice theoretical guarantees regarding overfitting, and with an appropriate kernel they can work well even if you’re data isn’t linearly separable in the base feature space. Especially popular in text classification problems where very high-dimensional spaces are the norm. Memory-intensive, hard to interpret, and kind of annoying to run and tune, though, so I think random forests are starting to steal the crown.

支持向量机: 高准确率,为避免过拟合提供了很好的理论保证,而且就算数据在原特征空间线性不可分,只要给个合适的核函数,它就能运行得很好。在动辄超高维的文本分类问题中特别受欢迎。可惜内存消耗大,难以解释,运行和调参也有些烦人,所以我认为随机森林要开始取而代之了。

But…

然而。。。

Recall, though, that better data often beats better algorithms, and designing good features goes a long way. And if you have a huge dataset, then whichever classification algorithm you use might not matter so much in terms of classification performance (so choose your algorithm based on speed or ease of use instead).

尽管如此,回想一下,好的数据却要优于好的算法,设计优良特征是大有裨益的。假如你有一个超大数据集,那么无论你使用哪种算法可能对分类性能都没太大影响(此时就根据速度和易用性来进行抉择)。

And to reiterate what I said above, if you really care about accuracy, you should definitely try a bunch of different classifiers and select the best one by cross-validation. Or, to take a lesson from the Netflix Prize (and Middle Earth), just use an ensemble method to choose them all.

再重申一次我上面说过的话,倘若你真心在乎准确率,你一定得尝试多种多样的分类器,并且通过交叉验证选择最优。要么就从Netflix Prize(和Middle Earth)取点经,用集成方法把它们合而用之,妥妥的。