Reputation: 11
I'm currently using scikit-multilearn for multilabel classification. I have to use
meka.classifiers.multilabel.CM as the meka_classifier.
But when I run my Code, I get different Errors and I don't understand why..
meka = Meka(
meka_classifier="meka.classifiers.multilabel.meta.CM",
weka_classifier = "weka.classifiers.trees.J48",
meka_classpath = meka_classpath#, #obtained via download_meka
)
print("Fit")
meka.fit(X_train, y_train)
I have to say, that the traningsdata and the paths (Weka & Java(via wichcraft)) are both working. If I exchange the meka_classifier with BR all works.
After running the code I get the following Error Message:
weka.core.UnsupportedAttributeTypeException: weka.classifiers.trees.J48: Cannot handle numeric class!
at weka.core.Capabilities.test(Capabilities.java:1067)
at weka.core.Capabilities.test(Capabilities.java:1256)
at weka.core.Capabilities.test(Capabilities.java:1138)
at weka.core.Capabilities.testWithFail(Capabilities.java:1468)
at weka.classifiers.trees.J48.buildClassifier(J48.java:277)
at meka.classifiers.multilabel.meta.CM.buildClassifier(CM.java:50)
at meka.classifiers.multilabel.Evaluation.runExperiment(Evaluation.java:229)
at meka.classifiers.multilabel.ProblemTransformationMethod.runClassifier(ProblemTransformationMethod.java:172)
at meka.classifiers.multilabel.ProblemTransformationMethod.evaluation(ProblemTransformationMethod.java:152)
at meka.classifiers.multilabel.meta.CM.main(CM.java:83)
It is weird, that it says that he can't handle numeric Values, because if I change to BR, the Classifier has no Problems with the (same) Data.
Above the Errormessage there is also a text about how to use the classifier (the options). So I tried it in another way:
meka = Meka(
meka_classifier = "meka.classifiers.multilabel.meta.CM -I 10 -W meka.classifiers.multilabel.CC - -S 0 -W weka.classifiers.trees.J48",
#weka_classifier = "weka.classifiers.trees.J48",
meka_classpath = meka_classpath#, #obtained via download_meka
)
print("Fit Data")
meka.fit(X_train, y_train)
print("Predict")
prediction = meka.predict(x_test)
The commandline with the weka_classifier is there, because I tried it in different ways (excluded the J48 from the meka_classifier and included it there). Anyway, I always get the same Error:
Traceback (most recent call last):
File "C:/Users/*****/Desktop/MachineLearningClassifier/blabla.py", line 72, in <module>
prediction = meka.predict(x_test)
File "D:\Users\*****\AppData\Local\Programs\Python\Python36\lib\site-packages\skmultilearn\ext\meka.py", line 314, in predict
self._parse_output()
File "D:\Users\*****\AppData\Local\Programs\Python\Python36\lib\site-packages\skmultilearn\ext\meka.py", line 374, in _parse_output
predictions = self.output_.split(predictions_split_head)[1].split(
IndexError: list index out of range
I've searched for this Error and there where people who had installed arff instead of liac-arff, but that's not the case here. And yeah, like I said, if I change to BR or something all works. It just doesn't work with CM. I don't know what to do now... I hope someone can help. Thanks in advance!
Best Greetings
EDIT:
After the fit() I have let me print meka.classifier_dump, and using the second Code I posted, it's empty! I've tested this with others like BR and there it's not empty. So I assume I'm doing something wrong in the Creation of the Classifier?
Upvotes: 0
Views: 290
Reputation: 1448
The error weka.core.UnsupportedAttributeTypeException: weka.classifiers.trees.J48: Cannot handle numeric class!
states that J48 algorithm cannot be used on numeric classes. Here class means the output that you want to learn, not an attribute used when learning. J48 can use numeric attributes but cannot predict numeric classes.
You cannot predict a numeric value in J48 (for example predicting temperature as an integer), you can only predict nominal types with J48 (eg one of cold/neutral/hot).
In order to use J48 you need to change the class to nominal.
Upvotes: 1