Hi,
I using the 'emotions.arff' example arff file, with only the first 20 instances. But when I use cross-validation, I get the following error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at mulan.evaluation.measure.MeanAverageInterpolatedPrecision.highestPrecisionAfterPos(MeanAverageInterpolatedPrecision.java:123)
at mulan.evaluation.measure.MeanAverageInterpolatedPrecision.getValue(MeanAverageInterpolatedPrecision.java:103)
at mulan.evaluation.MultipleEvaluation.calculateStatistics(MultipleEvaluation.java:92)
at mulan.evaluation.Evaluator.innerCrossValidate(Evaluator.java:283)
at mulan.evaluation.Evaluator.crossValidate(Evaluator.java:240)
My code:
import mulan.classifier.lazy.MLkNN;
import mulan.classifier.transformation.LabelPowerset;
import mulan.data.MultiLabelInstances;
import mulan.evaluation.Evaluator;
import mulan.evaluation.MultipleEvaluation;
import weka.classifiers.trees.J48;
import weka.core.Utils;
public class Mulan {
public static void main(String[] args) throws Exception {
String arffFilename = Utils.getOption("arff", args); // e.g. -arff emotions.arff
String xmlFilename = Utils.getOption("xml", args); // e.g. -xml emotions.xml
MultiLabelInstances dataset = new MultiLabelInstances(arffFilename, xmlFilename);
MLkNN learner2 = new MLkNN();
Evaluator eval = new Evaluator();
MultipleEvaluation results;
int numFolds = 2;
results = eval.crossValidate(learner2, dataset, numFolds);
System.out.println(results);
}
}
Anonymous
Hello!
This was indeed a bug in a previous version of Mulan.
Please, try
svn checkout svn://svn.code.sf.net/p/mulan/code/trunk mulan-codeand try re-running your code.If you come across the same problem, please contact us.
Thank you for your interest on behalf of the Mulan team.
Stefanos