}
// Finalize covariance matrix:
Vector mean = covmaker.getMeanVector();
Matrix cmati = covmaker.destroyToSampleMatrix().inverse();
DoubleMinMax minmax = new DoubleMinMax();
WritableDataStore<Double> scores = DataStoreUtil.makeStorage(attributes.getDBIDs(), DataStoreFactory.HINT_STATIC, Double.class);
for(DBID id : attributes.iterDBIDs()) {
Vector temp = deltas.get(id).minus(mean);
final Vector res = temp.transposeTimes(cmati).times(temp);
assert (res.getDimensionality() == 1);
double score = res.get(0);
minmax.put(score);
scores.put(id, score);
}
Relation<Double> scoreResult = new MaterializedRelation<Double>("Median multiple attributes outlier", "median-outlier", TypeUtil.DOUBLE, scores, attributes.getDBIDs());
OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta(minmax.getMin(), minmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 0);
OutlierResult or = new OutlierResult(scoreMeta, scoreResult);
or.addChildResult(npred);
return or;
}