Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

java.lang.IllegalArgumentException: Comparison method violates its general contract!

$
0
0
Hi,

Details:
I've installed weka 3.6.9 (downloaded in http://www.cs.waikato.ac.nz/ml/weka/downloading.html) for an Ubuntu 12.04, added the $CLASSPATH to the weka.jar, changed to +x and setting it to be oppened with OpenJDK Java 7 Runtime so that I can have a Weka icon on my Desktop (probably there are better ways, in that case, please, let me know how to do it).

When I want to run this command below (inside a bash script)
java weka.classifiers.meta.FilteredClassifier -t /home/criera/Documentos/batchAllGenes/$1/output/$1.arff -x 3 -s ${i} -p 1 -distribution -F "weka.filters.MultiFilter -F "weka.filters.unsupervised.attribute.RemoveType -T string\" -F \"weka.filters.supervised.instance.SMOTE -C 0 -K 5 -P $2 -S 1\"" -W weka.classifiers.functions.MultilayerPerceptron -- -L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H 0 > $MYPATH/results/$1.${i}.rbf

it prompts:

java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:747)
at java.util.TimSort.mergeAt(TimSort.java:483)
at java.util.TimSort.mergeForceCollapse(TimSort.java:426)
at java.util.TimSort.sort(TimSort.java:223)
at java.util.TimSort.sort(TimSort.java:173)
at java.util.Arrays.sort(Arrays.java:659)
at java.util.Collections.sort(Collections.java:217)
at weka.filters.supervised.instance.SMOTE.doSMOTE(SMOTE.java:637)
at weka.filters.supervised.instance.SMOTE.batchFinished(SMOTE.java:489)
at weka.filters.Filter.useFilter(Filter.java:663)
at weka.filters.MultiFilter.process(MultiFilter.java:378)
at weka.filters.SimpleStreamFilter.batchFinished(SimpleStreamFilter.java:289)
at weka.filters.MultiFilter.batchFinished(MultiFilter.java:396)
at weka.filters.Filter.useFilter(Filter.java:663)
at weka.classifiers.meta.FilteredClassifier.buildClassifier(FilteredClassifier.java:390)
at weka.classifiers.Evaluation.crossValidateModel(Evaluation.java:477)
at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:1269)
at weka.classifiers.Classifier.runClassifier(Classifier.java:312)
at weka.classifiers.meta.FilteredClassifier.main(FilteredClassifier.java:478)


Removing the SMOTE filter, works fine.

Clicking on weka.jar opens the GUI chooser and when I try Explorer, it works fine (I can apply SMOTE, although when I apply it repeatedly (i know there's no point in applying smote several times, I was just trying) it also prompts the error "comparison method violates...")

I've seen in another forum that someone suggested the following:

We have had a similar problem recently. We solved it (at least now it does not throw the exception) changing the following fragment (line 637 of the version available in the >package manager)



// sort the neighbors according to distance
Collections.sort(**distanceToInstance, new Comparator() {
public int compare(Object o1, Object o2) {
double distance1 = (Double) ((Object[]) o1)[0];
double distance2 = (Double) ((Object[]) o2)[0];
return (int) Math.ceil(distance1 - distance2);
}

});
> The return statement was changed to
return Double.compare(distance1, distance2);

But I don't know what are they doing here neither where to find this package manager. In Gui chooser > Tools I just have "arffviewer", "sqlviewer" and "bayes net editor".

Any suggestion of how to fix this problem?
If any additional info is needed, let me know.

Thanks a lot

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>