Use custom classifier with python-weka-wrapper

19 views
Skip to first unread message

Joanna Henzel

unread,
Jul 25, 2023, 10:27:59 AM7/25/23
to python-weka-wrapper
Hello!

I try to use a custom classifier with python-weka-wrapper. It is provided in JAR file and it is available here:


The authors say that it should be used as:

java -cp "weka.jar;mlrules.jar" weka.gui.GUIChooser

I added the mlrules.jar to `class_path` when running jvm as

jvm.start(max_heap_size="4g", system_info=True, packages=True, class_path=['/path/to/mlrules.jar'])

However in this case I get a following error

javabridge.jutil.JavaException: class weka.classifiers.rules.MLRules has interface weka.classifiers.Classifier as super class

Where should I add JAR with custom classifier when using python-weka-wrapper?



Peter Reutemann

unread,
Jul 25, 2023, 7:08:34 PM7/25/23
to python-we...@googlegroups.com
The code that you referenced was developed against an old version of
Weka, before the introduction of Weka packages, and is not compatible
with the version of Weka that pww3 uses (3.9.6 at time of writing).

I've converted the original code into an unofficial Weka package and
made it available here:
https://github.com/fracpete/mlrules-weka-package

You can install that Weka package with pww3. Here are some examples:
https://fracpete.github.io/python-weka-wrapper3/examples.html#packages

With that, you don't need to add a jar file to the classpath.

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, Hamilton, NZ
Mobile +64 22 190 2375
https://www.cs.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/

Joanna Henzel

unread,
Jul 26, 2023, 11:26:47 AM7/26/23
to python-weka-wrapper
Thank you very much for your help! Now I am able to use the MLRules package with the Python wrapper.
Reply all
Reply to author
Forward
0 new messages