Czytanie danych WEKA

0

Witam,

mam następujący problem. Chciałbym wczytać dane z pliku .arff, wykonuje polecenie jak na stronie:
http://weka.wikispaces.com/Use+WEKA+in+your+Java+code
Niestety dostaje komunikat: Unhandled exception type Exception.

Co może być nie tak? Z góry bardzo dziękuje za opdowiedź.

import weka.core.Instances;
import weka.core.converters.ConverterUtils.DataSource;  
    
	
    public class test{

		/**
		 * @param args
		 */

       public static void main(String[] args) {  
         
    	       
    	   String filename = "Iris.arff";
    	   
    	   
    	   // Read all the instances in the file (ARFF, CSV, XRFF, ...)
    	   DataSource source = new DataSource(filename);
    	   Instances instances = source.getDataSet();

    	   // Make the last attribute be the class
    	   instances.setClassIndex(instances.numAttributes() - 1);
    	   
    	   // Print header and instances.
    	   System.out.println("\nDataset:\n");
    	   System.out.println(instances);
    	  
        
    	   
    	  }  
   }
    
 
0

Przecież pliku może nie być i poniższa instrukcja się nie powiedzie.

   DataSource source = new DataSource(filename);

Musisz obsłużyć wyjątek.

0 użytkowników online, w tym zalogowanych: 0, gości: 0