3 回答
For the last line with attribute ‘imf’, the labels are reversed
so I assume that this is the cause of the problem:
but how can I solve it?
Change test arff file so that it has same header with training file. Both training and testing file should have same header information apart from relation name. Make it so that last line of header is
@attribute imf {TRUE,FALSE}
I had the same problem see this question and answer. Basically you decide a header information and put it to another file. Then your every data set use same header information. Either do this using coding or create arff files by hand.
I had an email exchange with Eibe Frank of Weka yesterday re this point. The conversation can be seen here:
https://list.scms.waikato.ac.nz/pipermail/wekalist/2013-April/057698.html
He made several suggestions including using the same Weka NumericToNominal object for both training and testing datasets, or to preserve the same object by serialisation if training and testing datasets are generated at different times.
In my case, however, the best solution is to use integers 1 and 0 in place of TRUE and FALSE respectively, and regenerate the datasets affected.
Thanks to Atilla Ozgur though.
If we substitute the TRUE and FALSE with 0 and 1. We could not use some algorithms which are based on nominal results.