Weka 3.8 - 决策树 J48 似乎有正确的树来预测数据但在测试中失败

问题描述

决策树 J48 生成的树结构如下。

J48 修剪过的树

petalwidth <= 0.6: Iris-setosa (50.0)
petalwidth > 0.6
|   petalwidth <= 1.7
|   |   petallength <= 4.9: Iris-versicolor (48.0/1.0)
|   |   petallength > 4.9
|   |   |   petalwidth <= 1.5: Iris-virginica (3.0)
|   |   |   petalwidth > 1.5: Iris-versicolor (3.0/1.0)
|   petalwidth > 1.7: Iris-virginica (46.0/1.0)

但它未能对以下数据进行分类。有谁知道可能会出什么问题?

Plot : weka.classifiers.trees.J48 (iris)
Instance: 98
      sepallength : 5.0
       sepalwidth : 3.5
      petallength : 1.6
       petalwidth : 0.6
prediction margin : -1.0
  predicted class : Iris-versicolor
            class : Iris-setosa

解决方法

正如@fracpete 所评论的,我正在使用交叉验证。 Weka 在分类器输出中显示的是经历完整训练集的分类器模型,而不是预测模型。