Machine learning 韦卡混淆矩阵

Machine learning 韦卡混淆矩阵,machine-learning,weka,data-mining,confusion-matrix,Machine Learning,Weka,Data Mining,Confusion Matrix,我有以下数据集 天气 @relation weather.symbolic @attribute outlook {sunny, overcast, rainy} @attribute temperature {hot, mild, cool} @attribute humidity {high, normal} @attribute windy {TRUE, FALSE} @attribute play {yes, no} @data sunny,hot,high,FALSE,no sun

我有以下数据集 天气

@relation weather.symbolic

@attribute outlook {sunny, overcast, rainy}
@attribute temperature {hot, mild, cool}
@attribute humidity {high, normal}
@attribute windy {TRUE, FALSE}
@attribute play {yes, no}

@data
sunny,hot,high,FALSE,no
sunny,hot,high,TRUE,no
overcast,hot,high,FALSE,yes
rainy,mild,high,FALSE,yes
rainy,cool,normal,FALSE,yes 
rainy,cool,normal,TRUE,no  
overcast,cool,normal,TRUE,yes
sunny,mild,high,FALSE,no
sunny,cool,normal,FALSE,yes 
rainy,mild,normal,FALSE,yes
sunny,mild,normal,TRUE,yes
overcast,mild,high,TRUE,yes
overcast,hot,normal,FALSE,yes
rainy,mild,high,TRUE,no
我写了一个简单的程序如下

   if (data.classIndex() == -1)
        data.setClassIndex(4);

    J48 classifier = new J48();
    Evaluation eval = new Evaluation(data);
    eval.crossValidateModel(classifier, data, 10, new Random(1));

    System.out.println(eval.toMatrixString());
我得到了以下结果

=== Confusion Matrix ===

 a b   <-- classified as
 0 5 | a = no
 0 9 | b = yes
=== Confusion Matrix ===

 a b   <-- classified as
 9 0 | a = yes
 5 0 | b = no

我试图重新创建代码中提供的混淆矩阵,但没有成功。我使用weather.nominal.arff,正如Weka安装目录中提供的那样。我知道这会让你的问题变得很长,但你能提供培训数据吗?当使用你的文件和代码时,我得到一个混淆矩阵,在“a”列中有5个,3个,然后在“b”列中有4个,2个。当使用带有J48(默认选项)和10倍交叉验证的GUI时,我得到了相同的结果。我可能帮不了什么忙,因为我无法重新创建错误。我忘了提到的一件事是,我正在从数据库加载值。我已将arff文件中的值按原样保存在数据库中。。只有当我从数据库加载时,它才会产生问题,而不是当我使用normall arff文件时。很抱歉在开始时提供了误导性信息。
        InstanceQuery query = new InstanceQuery();
        query.setUsername("postgres");
        query.setPassword("*****");
        query.setQuery("SELECT * from weather");

        Instances data = query.retrieveInstances();