2014-01-29 83 views
0

我有以下方法,我需要一個新的未標記實例。我有最新的weka.jar文件,但它沒有DenseInstance類。那麼如何創建這樣一個實例呢?在Weka中創建一個未標記的實例而不使用DenseInstance類

public static void main(String[] args) throws Exception { 
     BufferedReader datafile = readDataFile("ads.txt"); 

     Instances data = new Instances(datafile); 
     data.setClassIndex(data.numAttributes() - 1); 

     Classifier ibk = new IBk(); 
     ibk.buildClassifier(data); 

     // here need a new unlabeled instance 
     double classif = ibk.classifyInstance(data.firstInstance()); 
     System.out.println(classif); 
    } 

回答

1

您確定您擁有weka.jar文件的最新版本? Weka 3.6並未在安裝目錄中使用DenseInstance類(開發者版本)3.7提供weka.jar文件。