I'm trying to learn rules on a given data using weka in python. Weka gets errors of 'Cannot handle string & numeric attributes'
I'm using https://github.com/fracpete/python-weka-wrapper3
At first, I did:
loader = Loader(classname="weka.core.converters.CSVLoader")
data = loader.load_file(path)
data.class_is_last()
But got:
javabridge.jutil.JavaException: weka.associations.Apriori: Cannot handle numeric attributes!
When trying to learn the rules.
I understand the error, weka wants nominal attributes. OK! I've searched and found ways to do it: http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/NominalToString.html
So I've tried:
loader = Loader(classname="weka.core.converters.CSVLoader")
data = loader.load_file(path)
nominal = Filter(classname="weka.filters.unsupervised.attribute.NumericToNominal", options=["-R", "first-last"])
nominal.inputformat(data)
nominal_data = nominal.filter(data)
nominal_data.class_is_last()
return nominal_data
But got:
javabridge.jutil.JavaException: weka.associations.Apriori: Cannot handle string attributes!
What am I missing? thanks