mahout分类算法效果评估指标

来源:互联网 发布:淘宝1元包邮专区 编辑:程序博客网 时间:2024/04/29 23:02

mahout中有许多分类器,包括Naive Bayes, Complementary Naive Bayes, Stochastic Gradient Descent, Support Vector Machine, Random Forest等。评估一个分类器(模型)的好坏,需要有一些指标,而在mahout中提供了下列衡量指标:

1. %-correct  (ConfusionMatrix类)

最简单的,即正确分类的比率

2. Confusion matrix (ConfusionMatrix类)

通常是一个两行两列的矩阵,数据如下:

[ # of true positives, # of false negatives,

 # of false positives, # of true negatives]

即为:

[正确分类为正的数量, 错误分类为负的数量,

错误分类为正的数量, 正确分类为负的数量]

一个较好的模型,应该是true positives和true negatives都远大于false negatives和false positives。

注意:false negative的代价实际上比false positive高得多。举例来说,垃圾邮件分类。正确分类为垃圾邮件为true positive,则将垃圾邮件分类为普通邮件(相当于未能将垃圾邮件正确分类为垃圾邮件)为false positive,将普通邮件分类为垃圾邮件为false negative。显然,将普通邮件分类成垃圾邮件的代价是远高于将垃圾邮件分类为普通邮件的。

confision matrix也可能是包含了所有分类结果的:

Confusion Matrix
-------------------------------------------------------
a   b   c   d   e   f  <--Classified as
9   0   1   0   0   0  |  10  a = one
0   9   0   0   1   0  |  10  b = two
0   0   10 0   0   0  |  10  c = three
0   0   1   8   1   0  |  10  d = four
1   1   0   0   7   1  |  10  e = five
0   0   0   0   1   9  |  10  f  = six
Default Category: one: 6

3. Entropy matrix (Auc类)

跟confusion matrix类似,但把具体的数量值变成了概率对数平均值。因而跟confusion matrix刚好相反,一个好的模型应该具有较小的对角线值。

4. AUC (Area under curve) (Auc, OnlineAuc, CrossFoldLearner, AdaptiveLogisticRegression)

简单地说,就是能够正确分类的概率。若AUC=0,则完全不能正确分类,模型很差;若AUC=1,则是个完美的模型。AUC只能用于二分类。

5. Log-likelihood (CrossFoldLearner, AdaptiveLogisticRegression)

对数似然,可以用于多分类,是最大值为0的负数。越接近0表示模型越好。
原创粉丝点击