我試圖用一個分類使用的Weka基於LIBSVM「無法處理數字類」中的Java代碼,但我得到這個錯誤:Weka的錯誤使用SVM
Exception in thread "main" weka.core.UnsupportedAttributeTypeException:weka.classifiers.functions.LibSVM: Cannot handle numeric class!
at weka.core.Capabilities.test(Unknown Source)
at weka.core.Capabilities.test(Unknown Source)
at weka.core.Capabilities.test(Unknown Source)
at weka.core.Capabilities.testWithFail(Unknown Source)
at weka.classifiers.functions.LibSVM.buildClassifier(Unknown Source)
at imgclassifier.ImgClassifier.main(ImgClassifier.java:45)
Java Result: 1
這是我的代碼:
try {
File f = new File("australian.txt");
LibSVMLoader loader = new LibSVMLoader();
loader.setSource(f);
Instances i = loader.getDataSet();
LibSVM svm = new LibSVM();
svm.buildClassifier(i);
}catch (IIOException e) {
e.printStackTrace();
}
australian.txt就是這裏採用的一個例子:LibSVM DataSets 任何人都可以解釋我錯誤在哪裏? 在此先感謝