将Weka分类器转换为分数

时间:2013-03-21 10:22:39

标签: machine-learning classification weka

我正在尝试将我的分类器结果转换为将实例分类为0或1,而是给出一个分数(置信度量?),比如0到10之间, 我正在使用RIDOR分类器,但也可以轻松地使用ClassificationViaRegression,RandomForest或AttributeSelectedClassifier,尽管它们也不能进行分类。

我已经将所有可能的内容输出到终端(检查了所有选项),但我无法在预测中的任何位置找到置信度量。另外我明白这些都没有输出源代码的选项吗?在这种情况下,我将不得不手动编码分类器。

以下是生成规则的示例:

    class = 2  (40536.0/20268.0)
       Except (fog <= 14.115114) and (polySyllabicWords/Sentence <= 1.973684) and (polySyllabicWords/Sentence <= 1.245) and (Characters/Word > 4.331715) => class = 1  (2309.0/5.0) [1137.0/4.0]
       Except (fog <= 14.115598) and (polySyllabicWords/Sentence <= 1.973684) and (polySyllabicWords/Sentence > 1.514706) => class = 1  (2281.0/0.0) [1112.0/0.0]
       Except (fog <= 14.136126) and (Words/Sentence > 19.651515) and (polySyllableCount <= 10.5) and (polySyllabicWords/Sentence > 2.416667) and (Syllables/Sentence <= 34.875) => class = 1  (601.0/0.0) [303.0/6.0]
       Except (fog <= 14.140863) and (polySyllabicWords/Sentence <= 1.944444) and (polySyllableCount <= 4.5) and (polySyllabicWords/Sentence <= 1.416667) and (wordCount > 29.5) and (Characters/Word <= 4.83156) => class = 1  (333.0/0.0) [152.0/0.0]
       Except (fog <= 14.142217) and (polySyllabicWords/Sentence <= 1.944444) and (polySyllableCount <= 4.5) and (polySyllabicWords/Sentence <= 1.416667) and (numOfChars > 30.5) and (Syllables/Word <= 1.474937) => class = 1  (322.0/0.0) [174.0/4.0]
       Except (fog <= 14.140863) and (polySyllabicWords/Sentence <= 1.75) and (polySyllableCount <= 4.5) => class = 1  (580.0/28.0) [298.0/21.0]
       Except (fog <= 14.141508) and (Syllables/Sentence > 25.585714) and (Words/Sentence > 19.683333) and (sentenceCount <= 4.5) and (polySyllabicWords/Sentence <= 2.291667) and (fog > 12.269468) => class = 1  (434.0/0.0) [202.0/0.0]
       Except (fog <= 14.140863) and (Syllables/Sentence > 25.866071) and (polySyllableCount <= 16.5) and (fog > 12.793102) and (polySyllabicWords/Sentence <= 2.9) and (wordCount <= 59.5) and (Words/Sentence > 16.166667) and (Words/Sentence <= 24.75) => class = 1  (291.0/0.0) [166.0/0.0]
       Except (fog <= 14.140863) and (Syllables/Sentence > 25.585714) and (Words/Sentence > 19.630682) and (polySyllabicWords/Sentence > 2.656863) and (polySyllableCount <= 16.5) and (fog > 13.560337) and (Words/Sentence <= 21.55) and (numOfChars <= 523) => class = 1  (209.0/0.0) [93.0/2.0]
       Except (fog <= 14.147578) and (Syllables/Word <= 1.649029) and (polySyllabicWords/Sentence <= 1.75) and (polySyllabicWords/Sentence > 1.303846) and (polySyllabicWords/Sentence <= 1.422619) and (fog > 9.327132) => class = 1  (183.0/0.0) [64.0/0.0]......

我也不确定第一行是什么意思(40536/20368) - 这只是意味着将其归类为2,除非以下规则之一适用?

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

通常,从分类器中获得置信度并不是一件容易的事,特别是如果你想要校准它(例如表现为分类正确的机会)。但是,有几种相对简单的方法可以进行粗略估计。

使用基于树和规则的分类器,括号中的数字表示存储桶中包含的正确/不正确样本的数量。因此,例如,一个带有(20,2)的桶意味着有20个案例,这个规则是正确的,2个是根据列车数据不正确的情况。您可以使用此比率作为信心的粗略衡量标准。

使用回归时,您可以让WEKA输出分类器的实际数值结果(而不仅仅是类),并对其进行置信度测量。

更一般地说,在文档之后,您可以使用命令行的-p选项(请参阅here)。但是,我不确定如何计算这些数字。