supplied test set in weka python

38 views
Skip to first unread message

Aldo Rodríguez

unread,
Nov 7, 2018, 12:53:14 AM11/7/18
to python-weka-wrapper
hello, someone will have an example of implementing supplied test set in weka python, I have a training set and a test set but I would like to use the weka sdk with python. first of all, Thanks
wekaimg.PNG

Peter Reutemann

unread,
Nov 7, 2018, 1:45:02 AM11/7/18
to python-weka-wrapper
> hello, someone will have an example of implementing supplied test set in weka python, I have a training set and a test set but I would like to use the weka sdk with python. first of all, Thanks

Have you had a look at the example repository?
https://github.com/fracpete/python-weka-wrapper-examples

For instance, here is an example of splitting a dataset into
train/test, training a classifier and then evaluating it:
https://github.com/fracpete/python-weka-wrapper-examples/blob/master/src/wekaexamples/classifiers/train_test_split.py

The exact examples also exist for the Python 3 version of the library
(you didn't specify what version of the library you're using):
https://github.com/fracpete/python-weka-wrapper3-examples

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 858-5174
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/

Aldo Rodríguez

unread,
Nov 7, 2018, 2:01:21 AM11/7/18
to python-weka-wrapper
I use python3, I have two predefined files, a test set and a training set, I understand that in the example:


It does a split test and generates an automatic test set but I just want to evaluate it with the test set I already have.
traintest.PNG

Peter Reutemann

unread,
Nov 7, 2018, 2:43:50 AM11/7/18
to python-weka-wrapper
It should be obvious, that in your case you just load two datasets from disks. Building and testing is the same.

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 858-5174
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
--
You received this message because you are subscribed to the Google Groups "python-weka-wrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-weka-wra...@googlegroups.com.
To post to this group, send email to python-we...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/61147744-e097-4b29-a1aa-f7ed18e91458%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aldo Rodríguez

unread,
Nov 7, 2018, 2:56:58 AM11/7/18
to python-weka-wrapper
yes although I get an error, I do not know what is due, I'll show it in the image, thank you very much for the attention
img3.PNG

Aldo Rodríguez

unread,
Nov 7, 2018, 2:57:51 AM11/7/18
to python-weka-wrapper


El martes, 6 de noviembre de 2018, 23:53:14 (UTC-6), Aldo Rodríguez escribió:
img3.PNG

Peter Reutemann

unread,
Nov 7, 2018, 3:09:02 AM11/7/18
to python-weka-wrapper
You didn't set the class attribute for the test set. Hence the error message, class not set.

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 858-5174
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
--
You received this message because you are subscribed to the Google Groups "python-weka-wrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-weka-wra...@googlegroups.com.
To post to this group, send email to python-we...@googlegroups.com.

Aldo Rodríguez

unread,
Nov 7, 2018, 3:14:51 AM11/7/18
to python-weka-wrapper
yes but I get the following error



El martes, 6 de noviembre de 2018, 23:53:14 (UTC-6), Aldo Rodríguez escribió:
img4.PNG

Peter Reutemann

unread,
Nov 7, 2018, 3:18:59 AM11/7/18
to python-weka-wrapper
This is Python, not Java. Check the API documentation.

The training set is getting the class attribute set as well. Use the same approach.

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 858-5174
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
--
You received this message because you are subscribed to the Google Groups "python-weka-wrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-weka-wra...@googlegroups.com.
To post to this group, send email to python-we...@googlegroups.com.

Aldo Rodríguez

unread,
Nov 7, 2018, 3:28:33 AM11/7/18
to python-weka-wrapper
Excuse me, I will have some example, I would appreciate very much





El martes, 6 de noviembre de 2018, 23:53:14 (UTC-6), Aldo Rodríguez escribió:

Peter Reutemann

unread,
Nov 7, 2018, 3:32:35 AM11/7/18
to python-weka-wrapper
Check the example code where the class attribute is set for the training set.


Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 858-5174
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
--
You received this message because you are subscribed to the Google Groups "python-weka-wrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-weka-wra...@googlegroups.com.
To post to this group, send email to python-we...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages