public List<Prediction> getPredictionErrors() {
        if (this.confusionMatrixMetaData == null)
            return null;

        List<Prediction> list = new ArrayList<>();

        List<Map.Entry<Pair<Integer, Integer>, List<Object>>> sorted =
                        new ArrayList<>(confusionMatrixMetaData.entrySet());
        Collections.sort(sorted, new Comparator<Map.Entry<Pair<Integer, Integer>, List<Object>>>() {
            @Override
            public int compare(Map.Entry<Pair<Integer, Integer>, List<Object>> o1,
                            Map.Entry<Pair<Integer, Integer>, List<Object>> o2) {
                Pair<Integer, Integer> p1 = o1.getKey();
                Pair<Integer, Integer> p2 = o2.getKey();
                int order = Integer.compare(p1.getFirst(), p2.getFirst());
                if (order != 0)
                    return order;
                order = Integer.compare(p1.getSecond(), p2.getSecond());
                return order;
            }
        });

        for (Map.Entry<Pair<Integer, Integer>, List<Object>> entry : sorted) {
            Pair<Integer, Integer> p = entry.getKey();
            if (p.getFirst().equals(p.getSecond())) {
                //predicted = actual -> not an error -> skip
                continue;
            }
            for (Object m : entry.getValue()) {
                list.add(new Prediction(p.getFirst(), p.getSecond(), m));
            }
        }

        return list;
    }
public List < Prediction > getPredictionErrors ( ) { if ( this . confusionMatrixMetaData == null ) return null ; List < Prediction > list = new ArrayList < > ( ) ; List < Map . Entry < Pair < Integer , Integer > , List < Object > > > sorted = new ArrayList < > ( confusionMatrixMetaData . entrySet ( ) ) ; Collections . sort ( sorted , new Comparator < Map . Entry < Pair < Integer , Integer > , List < Object > > > ( ) { @ Override public int compare ( Map . Entry < Pair < Integer , Integer > , List < Object > > o1 , Map . Entry < Pair < Integer , Integer > , List < Object > > o2 ) { Pair < Integer , Integer > p1 = o1 . getKey ( ) ; Pair < Integer , Integer > p2 = o2 . getKey ( ) ; int order = Integer . compare ( p1 . getFirst ( ) , p2 . getFirst ( ) ) ; if ( order != 0 ) return order ; order = Integer . compare ( p1 . getSecond ( ) , p2 . getSecond ( ) ) ; return order ; } } ) ; for ( Map . Entry < Pair < Integer , Integer > , List < Object > > entry : sorted ) { Pair < Integer , Integer > p = entry . getKey ( ) ; if ( p . getFirst ( ) . equals ( p . getSecond ( ) ) ) { continue ; } for ( Object m : entry . getValue ( ) ) { list . add ( new Prediction ( p . getFirst ( ) , p . getSecond ( ) , m ) ) ; } } return list ; }
Get a list of prediction errors, on a per-record basis<br>
<p>
<b>Note</b>: Prediction errors are ONLY available if the "evaluate with metadata"  method is used: {@link #eval(INDArray, INDArray, List)}
Otherwise (if the metadata hasn't been recorded via that previously mentioned eval method), there is no value in
splitting each prediction out into a separate Prediction object - instead, use the confusion matrix to get the counts,
via {@link #getConfusionMatrix()}

@return A list of prediction errors, or null if no metadata has been recorded