我正在使用python-weka-wrapper,我无法在命令提示符或IDLE中从weka加载任何数据集

时间:2016-02-21 15:04:10

标签: python-2.7

它引发了一个与javabridge相关的错误。我如何解决这个问题并加载数据集?

>>> import weka.core.jvm as jvm
>>> jvm.start()  
>>> data_dir="C:/Program Files/Weka-3-6/data"
>>> from weka.core.converters import Loader
>>> loader = Loader(classname="weka.core.converters.ArffLoader")
>>> data = loader.load_file(data_dir + "iris.arff")
Exception in thread "Thread-0" java.io.IOException: No source has been specified
at weka.core.converters.ArffLoader.getDataSet(ArffLoader.java:1226)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\weka\core\converters.py", line 82, in load
_file
return Instances(javabridge.call(self.jobject, "getDataSet", "()Lweka/core/I
nstances;"))
File "C:\Python27\lib\site-packages\javabridge\jutil.py", line 855, in call
result = fn(*nice_args)
File "C:\Python27\lib\site-packages\javabridge\jutil.py", line 822, in fn
raise JavaException(x)
javabridge.jutil.JavaException: No source has been specified

1 个答案:

答案 0 :(得分:0)

您的data_dir路径没有斜杠。将其与iris.arff连接后,您将获得C:/Program Files/Weka-3-6/datairis.arff,这显然不存在(No source has been specified)。