我正在尝试使用python 3.6在我的mackbook上运行weka https://www.futurelearn.com/courses/advanced-data-mining-with-weka/0/steps/29491
当我运行示例时,我不断收到以下错误,这里是完整输出错误:
DEBUG:weka.core.jvm:Adding bundled jars
DEBUG:weka.core.jvm:Adding Weka packages
DEBUG:weka.core.jvm:package_dir=/Users/xxx/wekafiles/packages
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/bayesianLogisticRegression
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/wekaPython
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/associationRulesVisualizer
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/anonymizationPackage
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/J48Consolidated
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/hiveJDBC
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/SVMAttributeEval
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/classAssociationRules
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/distributedWekaHadoopCore
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/chiSquaredAttributeEval
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/bestFirstTree
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/timeseriesForecasting
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/multiLayerPerceptrons
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/imageFilters
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/normalize
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPU
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/attributeSelectionSearchMethods
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/scatterPlot3D
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/XMeans
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/distributedWekaHadoop
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/denormalize
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/predictiveApriori
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/LibSVM
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs
DEBUG:weka.core.jvm: directory=/Users/xxx/wekafiles/packages/distributedWekaBase
DEBUG:weka.core.jvm:Classpath=['/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/javabridge/jars/rhino-1.7R4.jar', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/javabridge/jars/runnablequeue.jar', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/javabridge/jars/cpython.jar', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/nd4j-native-0.8.0-windows-x86_64.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/nd4j-native-0.8.0-linux-x86_64.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/openblas-0.2.19-1.3-macosx-x86_64.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/openblas-0.2.19-1.3-linux-x86_64.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/javacpp-1.3.2.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/nd4j-native-0.8.0-macosx-x86_64.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/openblas-0.2.19-1.3-windows-x86_64.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/openblas-0.2.19-1.3.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCPULibs/lib/nd4j-native-0.8.0.jar', '/Users/xxxx/wekafiles/packages/bayesianLogisticRegression/bayesianLogisticRegression.jar', '/Users/xxx/wekafiles/packages/wekaPython/wekaPython.jar', '/Users/xxx/wekafiles/packages/wekaPython/lib/commons-codec-1.3.jar', '/Users/xxx/wekafiles/packages/wekaPython/lib/commons-io-1.3.2.jar', '/Users/xxx/wekafiles/packages/wekaPython/lib/jsyntaxpane-0.9.5-b29.jar', '/Users/xxx/wekafiles/packages/wekaPython/lib/boon-0.32.jar', '/Users/xxx/wekafiles/packages/associationRulesVisualizer/associationRulesVisualizer.jar', '/Users/xxx/wekafiles/packages/anonymizationPackage/anonymization.jar', '/Users/xxx/wekafiles/packages/J48Consolidated/J48Consolidated.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/commons-logging-1.1.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/hive-metastore-0.7.0-pentaho-1.0.0.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/libfb303-0.5.0.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/hive-exec-0.7.0-pentaho-1.0.0.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/slf4j-jcl-1.5.8.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/slf4j-api-1.5.8.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/hive-jdbc-0.7.0-pentaho-SNAPSHOT-withShingoFix.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/hadoop-core-0.20.2.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/libthrift-0.5.0.jar', '/Users/xxx/wekafiles/packages/hiveJDBC/lib/hive-service-0.7.0-pentaho-1.0.0.jar', '/Users/xxx/wekafiles/packages/SVMAttributeEval/SVMAttributeEval.jar', '/Users/xxx/wekafiles/packages/classAssociationRules/classAssociationRules.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopCore/distributedWekaHadoopCore.jar', '/Users/xxx/wekafiles/packages/chiSquaredAttributeEval/chiSquaredAttributeEval.jar', '/Users/xxx/wekafiles/packages/bestFirstTree/bestFirstTree.jar', '/Users/xxx/wekafiles/packages/timeseriesForecasting/timeseriesForecasting1.0.25.jar', '/Users/xxx/wekafiles/packages/timeseriesForecasting/lib/jcommon-1.0.14.jar', '/Users/xxx/wekafiles/packages/timeseriesForecasting/lib/jfreechart-1.0.13.jar', '/Users/xxx/wekafiles/packages/timeseriesForecasting/lib/commons-codec-1.3.jar', '/Users/xxx/wekafiles/packages/multiLayerPerceptrons/multiLayerPerceptrons.jar', '/Users/xxx/wekafiles/packages/imageFilters/imageFilters.jar', '/Users/xxx/wekafiles/packages/imageFilters/lib/commons-math3-3.2.jar', '/Users/xxx/wekafiles/packages/imageFilters/lib/opencv-249.jar', '/Users/xxx/wekafiles/packages/imageFilters/lib/lire.jar', '/Users/xxx/wekafiles/packages/imageFilters/lib/JOpenSurf.jar', '/Users/xxx/wekafiles/packages/normalize/normalize.jar', '/Users/xxx/wekafiles/packages/attributeSelectionSearchMethods/attributeSelectionSearchMethods.jar', '/Users/xxx/wekafiles/packages/scatterPlot3D/lib/vecmath.jar', '/Users/xxx/wekafiles/packages/scatterPlot3D/lib/j3dutils.jar', '/Users/xxx/wekafiles/packages/scatterPlot3D/lib/jogamp-fat.jar', '/Users/xxx/wekafiles/packages/scatterPlot3D/lib/j3dcore.jar', '/Users/xxx/wekafiles/packages/scatterPlot3D/scatterPlot3D.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/slf4j-api-1.7.21.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/guava-19.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/nd4j-common-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/deeplearning4j-nn-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/nd4j-jackson-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/commons-math3-3.6.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/nd4j-api-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/nd4j-native-api-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/nd4j-context-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/reflections-0.9.10.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/jai-imageio-core-1.3.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/imageio-metadata-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/slf4j-jdk14-1.7.21.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/datavec-nd4j-common-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/imageio-psd-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/imageio-core-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/javassist-3.12.1.GA.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/common-io-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/common-lang-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/common-image-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/datavec-api-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/imageio-jpeg-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/commons-io-2.5.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/commons-codec-1.10.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/lombok.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/datavec-data-image-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/opencv-3.1.0-1.2.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/jackson-0.7.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/imageio-bmp-3.2.1.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/lib/deeplearning4j-core-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/nd4j-base64-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/wekaDeeplearning4jCore.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/nd4j-buffer-0.8.0.jar', '/Users/xxx/wekafiles/packages/wekaDeeplearning4jCore/commons-lang3-3.5.jar', '/Users/xxx/wekafiles/packages/XMeans/XMeans.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoop/distributedWekaHadoop.jar', '/Users/xxx/wekafiles/packages/denormalize/denormalize.jar', '/Users/xxx/wekafiles/packages/predictiveApriori/predictiveApriori.jar', '/Users/xxx/wekafiles/packages/LibSVM/LibSVM.jar', '/Users/xxx/wekafiles/packages/LibSVM/lib/libsvm.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jaxb-impl-2.2.3-1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-math-2.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/activation-1.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jackson-mapper-asl-1.8.8.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-configuration-1.6.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-beanutils-1.7.0.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-logging-1.1.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/stax-api-1.0-2.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jaxb-api-2.2.2.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/oro-2.0.8.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jackson-xc-1.7.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jersey-json-1.8.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-cli-1.2.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-digester-1.8.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jackson-core-asl-1.8.8.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jackson-jaxrs-1.7.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jets3t-0.6.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/xmlenc-0.52.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/hadoop-core-1.1.2.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jersey-core-1.8.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-net-1.4.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-codec-1.4.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jersey-server-1.8.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-beanutils-core-1.8.0.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/jettison-1.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-io-2.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-collections-3.2.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/asm-3.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/hsqldb-1.8.0.10.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/stax-api-1.0.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-lang-2.4.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-el-1.0.jar', '/Users/xxx/wekafiles/packages/distributedWekaHadoopLibs/lib/commons-httpclient-3.0.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/distributedWekaBase.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/concurrent-1.3.4.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/jcommon-1.0.16.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/opencsv-2.3.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/colt-1.2.0.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/jfreechart-1.0.13.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/t-digest-3.1.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/commons-codec-1.3.jar', '/Users/xxx/wekafiles/packages/distributedWekaBase/lib/la4j-0.4.5.jar']
DEBUG:weka.core.jvm:MaxHeapSize=default
DEBUG:javabridge.jutil:Creating JVM object
DEBUG:javabridge.jutil:Launching VM in non-python thread
DEBUG:javabridge.jutil:Attaching to VM in monitor thread
DEBUG:javabridge.jutil:Signalling caller
Failed to get class weka/core/converters/ConverterUtils
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: weka/core/converters/ConverterUtils
Caused by: java.lang.ClassNotFoundException: weka.core.converters.ConverterUtils
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Traceback (most recent call last):
File "/Users/xxx/Downloads/python-weka-wrapper3-master/run.py", line 13, in <module>
data = conv.load_any_file("anneal.arff")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/weka/core/converters.py", line 255, in load_any_file
loader = loader_for_file(filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/weka/core/converters.py", line 239, in loader_for_file
"(Ljava/lang/String;)Lweka/core/converters/AbstractFileLoader;", filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/javabridge/jutil.py", line 934, in static_call
fn = make_static_call(class_name, method_name, sig)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/javabridge/jutil.py", line 908, in make_static_call
raise JavaException(jexception)
javabridge.jutil.JavaException: weka/core/converters/ConverterUtils
完整的代码在这里
# imports
import weka.core.jvm as jvm
import weka.core.converters as conv
from weka.classifiers import Evaluation, Classifier
from weka.core.classes import Random
import weka.plot.classifiers as plcls # NB: matplotlib is required
import os
# start jvm
jvm.start(packages=True)
# load data
data = conv.load_any_file("anneal.arff")
data.class_is_last()
# configure classifier
cls = Classifier(classname="weka.classifiers.functions.LinearRegression",
options=["-C", "-S", "1"])
# cross-validate classifier
evl = Evaluation(data)
evl.crossvalidate_model(cls, data, 10, Random(1))
# plot errors
plcls.plot_classifier_errors(evl.predictions, absolute=False, wait=True)
# stop jvm
jvm.stop()
我甚至指向本地文件夹中的weka.jar库但仍然会发生,有人可以帮忙吗?