class ROCAUC implements Metric<Double> {

    @Override public double score(Iterator<LabelPair<Double>> iter) {
        //TODO: It should work with not binary values only, see IGNITE-11680.

        PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(Comparator.comparingDouble(Pair::getKey));

        long pos = 0;
        long neg = 0;

        while (iter.hasNext()) {
            LabelPair<Double> e = iter.next();

            Double prediction = e.getPrediction();
            Double truth = e.getTruth();

            queue.add(new Pair<>(prediction, truth));

            if (truth == positiveClsLb)
                pos++;
            else if (truth == negativeClsLb)
                neg++;
            else
                throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb);

        }

        return calculateROCAUC(queue, pos, neg, positiveClsLb);
    }

}