List of usage examples for org.apache.commons.math.stat.descriptive.moment Mean evaluate
@Override public double evaluate(final double[] values, final int begin, final int length)
Double.NaN
if the designated subarray is empty. From source file:de.tudarmstadt.ukp.dkpro.tc.weka.evaluation.MekaEvaluationUtils.java
/** * Calculates a number of evaluation measures for multi-label classification, without class-wise measures. * //from w w w .j ava2 s.c o m * @param predictions * predictions by the classifier (ranking) * @param goldStandard * gold standard (bipartition) * @param t * a threshold to create bipartitions from rankings * @return the evaluation statistics */ public static HashMap<String, Double> calcMLStats(double predictions[][], int goldStandard[][], double t[]) { int N = goldStandard.length; int L = goldStandard[0].length; int Ypred[][] = ThresholdUtils.threshold(predictions, t); HashMap<String, Double> results = new LinkedHashMap<String, Double>(); Mean mean = new Mean(); results.put(NUMBER_LABELS, (double) L); results.put(NUMBER_EXAMPLES, (double) N); results.put(ZERO_ONE_LOSS, Metrics.L_ZeroOne(goldStandard, Ypred)); results.put(LABEL_CARDINALITY_PRED, MLUtils.labelCardinality(Ypred)); results.put(LABEL_CARDINALITY_REAL, MLUtils.labelCardinality(goldStandard)); results.put(AVERAGE_THRESHOLD, mean.evaluate(t, 0, t.length)); // average results.put(EMPTY_VECTORS, MLUtils.emptyVectors(Ypred)); return results; }