Problem getting rules for Jrip classifier

18 views
Skip to first unread message

Dario Martinez

unread,
Feb 24, 2024, 8:30:39 AMFeb 24
to python-weka-wrapper
Good morning, I am generating rules with Jrip with the following code:
labor_data.train_test_split(70, Random(1))
jrip.build_classifier(labor_data)
rset = jrip.jwrapper.getRuleset()
for i in range(rset.size()):
       r = rset.get(i)
       print(str(r.toString(labor_data.class_attribute.jobject)))

As you can see, the data set is divided into train and test, I already checked and the rules it gives me are the same as the weka Explorer corresponding to "Out model" see red date in the following image, but with the problem which classifies them in reverse, that is, the LABEL attribute, which is the one I am classifying, has two possible values UP or Down, and the Explorer is giving me the rules => LABEL=UP, while in python it is giving me exactly the same rules, but at the end it appears => LABEL=Down, that is, just the opposite, how can I solve this?
Additionally, I have the problem that it is giving me only the rules corresponding to the "Output model" as I mentioned before, and I need it to give me the rules corresponding to the "Output models for training splits" see green date in the image, how can I configure via code, the image panel options, to obtain only the rules of the "Output models for training splits"? . Greetings.

Classifier evaluation options.PNG

Peter Reutemann

unread,
Feb 25, 2024, 2:35:30 PMFeb 25
to python-we...@googlegroups.com
When you check "Output model" in the Weka Explorer this will output a
model that has been trained on the *full* dataset.
After that, the chosen evaluation method will be executed: e.g., if
you choose train/test split then the data will be split according to
the percentage, a model trained on the train split and then evaluated
against the test set. The statistics collected from the test set are
then printed out.

It is to be expected that the model will be different, as two
different training sets were used to build them

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/
Reply all
Reply to author
Forward
0 new messages