Waikato / meka

Multi-label classifiers and evaluation procedures using the Weka machine learning framework.
http://waikato.github.io/meka/
GNU General Public License v3.0
200 stars 76 forks source link

Classifier Chains fails if there is only one label #38

Closed niedakh closed 7 years ago

niedakh commented 7 years ago

Hi,

in theory if there is only one label, classifier chains should behave like binary relevance. But they don't, they actually break:

Same hapens with PMCC.

java.lang.IllegalArgumentException: bound must be positive
    at java.util.Random.nextInt(Random.java:388)
    at meka.core.A.swap(A.java:268)
    at meka.classifiers.multilabel.MCC.buildClassifier(MCC.java:91)
    at meka.classifiers.multilabel.Evaluation.runExperiment(Evaluation.java:228)
    at meka.classifiers.multilabel.ProblemTransformationMethod.runClassifier(ProblemTransformationMethod.java:172)
    at meka.classifiers.multilabel.ProblemTransformationMethod.evaluation(ProblemTransformationMethod.java:152)
    at meka.classifiers.multilabel.MCC.main(MCC.java:250)

Could you fix this? I finally have the time to sit down with experiments we talked about with @jmread in Macedonia, and this breaks a lot for me :(

jmread commented 7 years ago

I just committed a fix for this. PMCC should now work fine even when a single label is given. This problem was due to PMCC trying to swap two values in an array of size one.