我正在嘗試一些使用weka API for Java的簡單代碼。在嘗試查找numberofAttributes時,它會觸發任何.data文件的錯誤。雖然它可以很好地處理.arff文件。 從UCI repoWEKA的.data文件的類路徑錯誤
---Registering Weka Editors---
Trying to add database driver (JDBC): RmiJdbc.RJDriver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): jdbc.idbDriver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): org.gjt.mm.mysql.Driver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): com.mckoi.JDBCDriver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): org.hsqldb.jdbcDriver - Error, not in CLASSPATH?
java.io.IOException: premature end of line. Expected attribute type., read Token[EOL], line 5
at weka.core.converters.ConverterUtils.errms(ConverterUtils.java:912)
at weka.core.converters.C45Loader.readHeader(C45Loader.java:417)
at weka.core.converters.C45Loader.getStructure(C45Loader.java:211)
at weka.core.converters.C45Loader.getDataSet(C45Loader.java:234)
at weka.core.converters.ConverterUtils$DataSource.getDataSet(ConverterUtils.java:268)
at MetaFeatureStatistical.main(MetaFeatureStatistical.java:42)
Exception in thread "main" java.lang.NullPointerException
at MetaFeatureStatistical.main(MetaFeatureStatistical.java:43)
行號42下載的文件和43如下:
instances=source.getDataSet();
instances.setClassIndex(instances.numAttributes()-1);
看來你的jdbc安裝存在一些問題,它與你的weka項目耦合。 – mostruash 2013-02-18 19:46:27
@mostruash havnt添加了任何JDBC jars,我也不需要它。簡單的數據文件躺在一個文件夾,我試圖訪問 – MalTec 2013-02-19 06:03:52