I am implementing a classifier that uses MultiFilter (to filter data by removing first two attributes and transforming the last string class attribute in the binary format) -- http://weka.8497.n7.nabble.com/Regression-supervised-learning-tt40588.html. FilteredClassifier would use this MultiFilter for classification: first internally filtering and then classifying the data. However, it doesn't work as expected:addID = Filter(classname="weka.filters.unsupervised.attribute.AddID", options=["-C", "first", "-N", "ID"])# transform the supervised outcome of an experiment from a nominal/string in a numeric valuetransformN_S_NV = Filter(classname="weka.filters.unsupervised.attribute.StringToNominal", options=["-R", "last"])transformN_B = Filter(classname="weka.filters.unsupervised.attribute.NominalToBinary", options=["-R", "last"])remove = Filter(classname="weka.filters.unsupervised.attribute.Remove", options=["-R", "1,2"])multiFilter = Filter(classname="weka.filters.MultiFilter")multiFilter.filters=[addID, remove, transformN_S_NV, transformN_B]multiFilter.inputformat(testClassifierInstances)(!!!) filtered = multiFilter.filter(testClassifierInstances)metaClassifier = Classifier(classname="weka.classifiers.meta.FilteredClassifier")metaClassifier.classifier = Classifier(classname="weka.classifiers.functions.SMOreg")metaClassifier.filter = multiFilter###bulding classifierThe problem is: it seems, the last three rows don't have any effect at all (when building, FilteredClassifier transfers data without applying the filter to SMOreg that doesn't work with the string attributes). What do I miss?When using the FilteredClassifier approach, training filter and base classifier is pointless, as the FilteredClassifier does that itself.
Also, the FilteredClassifier, starting with version 3.9.1, checks whether the class attribute got modified and throws an exception.
Without the actual data, it's hard to see what's going wrong, therefore I've attached a modified iris dataset (class attribute is now string instead of nominal) and some example code for applying the code. Instead of using the FilteredClassifier with all the filters (and to avoid the "class attribute got changed" exception), I push the data through the MultiFilter, leaving the ID attribute intact. Then I use the FilteredClassifier with SMOreg and the Remove filter to avoid having the ID attribute as part of the model.
NB: Not all filters will process the class attribute, most of them leave it alone. Hence I use the ClassAssigner filter to unset and the reassign the class attribute.
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 a topic in the Google Groups "python-weka-wrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-weka-wrapper/nToUq-M-aHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsub...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CAHoQ12Kok2gyaOchriTQA7sOuA7DOoO78P7rAS_bPUv8gweYXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsubscri...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "python-weka-wrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-weka-wrapper/nToUq-M-aHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsub...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CAHoQ12KgD-VkYtw4y_yO8snayso230r6T4-z1sT1zL%3DYYB1cmQ%40mail.gmail.com.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsubscribe...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CAHoQ12KgD-VkYtw4y_yO8snayso230r6T4-z1sT1zL%3DYYB1cmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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-wrapper+unsub...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CALWTjc1wC78vegbTUWUUHJCtKRq7%2BkB7zddQOm%3DR2DmtMa24kA%40mail.gmail.com.
If you turn your STRING class into a NOMINAL one before using
FilteredClassifier, then it should work.
On May 20, 2017 7:41:38 AM GMT+12:00, osherenko <oshe...@gmail.com> wrote:
Did you mean repo on https://github.com/fracpete/python-weka-wrapper where you checked in the changes?Best, AlexanderVon meinem Samsung Galaxy Smartphone gesendet.
-------- Ursprüngliche Nachricht --------Von: Peter Reutemann <frac...@gmail.com>Datum: 19.05.17 21:10 (GMT+01:00)
Betreff: Re: Re: MultiFilter and FilteredClassifier
On May 20, 2017 12:49:00 AM GMT+12:00, osherenko <oshe...@gmail.com> wrote:
Thanks, checked out already. Will update and build.Can I access this new method on the console as parameter?Best, AlexanderVon meinem Samsung Galaxy Smartphone gesendet.
-------- Ursprüngliche Nachricht --------Von: Peter Reutemann <frac...@gmail.com>Datum: 19.05.17 13:10 (GMT+01:00)
--
You received this message because you are subscribed to a topic in the Google Groups "python-weka-wrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-weka-wrapper/nToUq-M-aHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsub...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/456B0FF6-5C03-4C1F-BB6B-ABD536A3B73A%40gmail.com.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsubscribe...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
I'm not quite sure why this comes as a surprise to you... The Python wrapper classes just enclose a Java object. It is up to you to choose the most convenient wrapper class.
Also, the jwrapper property exposes the underlying Java object if you should need low level access.
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 a topic in the Google Groups "python-weka-wrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-weka-wrapper/nToUq-M-aHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsub...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/C0EADD24-CA49-45E6-9AAA-0B7175174335%40gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "python-weka-wrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-weka-wrapper/nToUq-M-aHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsub...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CAHoQ12JOKZzywVnamo0%2BsY16ECUS_TfuD%2BALeJHW%3DDz9Q_R0KQ%40mail.gmail.com.
> 2. I wonder, how I can reliably read the number of an instance in instances.
> Is it possible only by reading the ID attribute value in an instance or I
> can store the ids of instances in memory and access them in folds?
Weka has no notion of row IDs, hence the use of ID attributes. As long
as you can ensure that the IDs are unique in a dataset, you should be
able to get the correct IDs within folds when performing/simulating
cross-validation.
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 a topic in the Google Groups "python-weka-wrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-weka-wrapper/nToUq-M-aHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsubscribe...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CAHoQ12Joc5vvPH28ucpUYwABPzZ1Gcrb6OULtOBdGs4Vg1Od5w%40mail.gmail.com.
>> > 2. I wonder, how I can reliably read the number of an instance in
> As far as I understood after inspecting the java source code, Instances are
> reordered in the Instances.stratify method that somehow swaps two instances
> i and j. Could you describe how this somehow works?
Not really, as I didn't write that code. Looks a bit like bubble sort, though.
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 a topic in the Google Groups "python-weka-wrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-weka-wrapper/nToUq-M-aHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-weka-wrapper+unsub...@googlegroups.com.
To post to this group, send email to python-weka-wrapper@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CAHoQ12Kj51H5%2Bv4F6zQwV2NL4vN5-qYqDgmCEu6VEue%3DHiyxvA%40mail.gmail.com.