[prev in list] [next in list] [prev in thread] [next in thread]
List: wekalist
Subject: [Wekalist] Regression with wrapper3
From: bujarra <thecoderxxxxxxxxx () gmail ! com>
Date: 2021-04-14 22:12:38
Message-ID: 1618438358480-0.post () n7 ! nabble ! com
[Download RAW message or body]
Hi all,
I'm trying to use Alternating Model Tree as regression with wrapper3 using
Spyder (Python). I've followed the example in here
https://fracpete.github.io/python-weka-wrapper/examples.html
This is my code:
from weka.classifiers import PredictionOutput, KernelClassifier, Kernel
from weka.core.converters import Loader
from weka.classifiers import Evaluation
from weka.core.classes import Random
loader = Loader(classname="weka.core.converters.ArffLoader")
data = loader.load_file( "car_vila.arff")
data.class_is_last()
cls = KernelClassifier(classname="weka.classifiers.functions.SMOreg",
options=["-N", "0"])
kernel =
Kernel(classname="weka.classifiers.functions.supportVector.RBFKernel",
options=["-G", "0.1"])
cls.kernel = kernel
pout =
PredictionOutput(classname="weka.classifiers.evaluation.output.prediction.PlainText")
evl = Evaluation(data)
evl.crossvalidate_model(cls, data, 10, Random(1), pout)
print(evl.summary())
print(pout.buffer_content())
import weka.plot.classifiers as plcls # NB: matplotlib is required
plcls.plot_classifier_errors(evl.predictions, wait=True)
I'm using the attached .arff file (I also tried with bolts.arff). However, I
get this error.
File "C:\X.py", line 13, in <module>
loader = Loader(classname="weka.core.converters.ArffLoader")
File "C:\anaconda3\lib\site-packages\weka\core\converters.py", line 42, in
__init__
jobject = Loader.new_instance(classname)
File "C:\anaconda3\lib\site-packages\weka\core\classes.py", line 669, in
new_instance
javabridge.class_for_name("java.lang.Object"), classname, [])
File "C:\anaconda3\lib\site-packages\javabridge\jutil.py", line 1743, in
class_for_name
ldr = static_call('java/lang/ClassLoader', 'getSystemClassLoader',
File "C:\anaconda3\lib\site-packages\javabridge\jutil.py", line 939, in
static_call
fn = make_static_call(class_name, method_name, sig)
File "C:\anaconda3\lib\site-packages\javabridge\jutil.py", line 910, in
make_static_call
klass = env.find_class(class_name)
AttributeError: 'NoneType' object has no attribute 'find_class'
Which is the cause of the error? It looks the ArffLoader.
car_vila.arff <https://weka.8497.n7.nabble.com/file/t7341/car_vila.arff>
Thanks in advance.
--
Sent from: https://weka.8497.n7.nabble.com/
_______________________________________________
Wekalist mailing list -- wekalist@list.waikato.ac.nz
Send posts to wekalist@list.waikato.ac.nz
To unsubscribe send an email to wekalist-leave@list.waikato.ac.nz
To subscribe, unsubscribe, etc., visit \
https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz List \
etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic