@Override
    public void eval(INDArray labels, INDArray predictions, INDArray mask, final List<? extends Serializable> recordMetaData) {

        Triple<INDArray,INDArray, INDArray> p = BaseEvaluation.reshapeAndExtractNotMasked(labels, predictions, mask, axis);
        if(p == null){
            //All values masked out; no-op
            return;
        }

        INDArray labels2d = p.getFirst();
        INDArray predictions2d = p.getSecond();
        INDArray maskArray = p.getThird();
        Preconditions.checkState(maskArray == null, "Per-output masking for ROCMultiClass is not supported");


        if(labels2d.dataType() != predictions2d.dataType())
            labels2d = labels2d.castTo(predictions2d.dataType());

        // FIXME: int cast
        int n = (int) labels2d.size(1);
        if (underlying == null) {
            underlying = new ROC[n];
            for (int i = 0; i < n; i++) {
                underlying[i] = new ROC(thresholdSteps, rocRemoveRedundantPts);
            }
        }

        if (underlying.length != labels2d.size(1)) {
            throw new IllegalArgumentException(
                            "Cannot evaluate data: number of label classes does not match previous call. " + "Got "
                                            + labels2d.size(1) + " labels (from array shape "
                                            + Arrays.toString(labels2d.shape()) + ")"
                                            + " vs. expected number of label classes = " + underlying.length);
        }

        for (int i = 0; i < n; i++) {
            INDArray prob = predictions2d.getColumn(i, true); //Probability of class i
            INDArray label = labels2d.getColumn(i, true);
            //Workaround for: https://github.com/deeplearning4j/deeplearning4j/issues/7305
            if(prob.rank() == 0)
                prob = prob.reshape(1,1);
            if(label.rank() == 0)
                label = label.reshape(1,1);
            underlying[i].eval(label, prob);
        }
    }
@ Override public void eval ( INDArray labels , INDArray predictions , INDArray mask , final List < ? extends Serializable > recordMetaData ) { Triple < INDArray , INDArray , INDArray > p = BaseEvaluation . reshapeAndExtractNotMasked ( labels , predictions , mask , axis ) ; if ( p == null ) { return ; } INDArray labels2d = p . getFirst ( ) ; INDArray predictions2d = p . getSecond ( ) ; INDArray maskArray = p . getThird ( ) ; Preconditions . checkState ( maskArray == null , "Per-output masking for ROCMultiClass is not supported" ) ; if ( labels2d . dataType ( ) != predictions2d . dataType ( ) ) labels2d = labels2d . castTo ( predictions2d . dataType ( ) ) ; int n = ( int ) labels2d . size ( 1 ) ; if ( underlying == null ) { underlying = new ROC [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { underlying [ i ] = new ROC ( thresholdSteps , rocRemoveRedundantPts ) ; } } if ( underlying . length != labels2d . size ( 1 ) ) { throw new IllegalArgumentException ( "Cannot evaluate data: number of label classes does not match previous call. " + "Got " + labels2d . size ( 1 ) + " labels (from array shape " + Arrays . toString ( labels2d . shape ( ) ) + ")" + " vs. expected number of label classes = " + underlying . length ) ; } for ( int i = 0 ; i < n ; i ++ ) { INDArray prob = predictions2d . getColumn ( i , true ) ; INDArray label = labels2d . getColumn ( i , true ) ; if ( prob . rank ( ) == 0 ) prob = prob . reshape ( 1 , 1 ) ; if ( label . rank ( ) == 0 ) label = label . reshape ( 1 , 1 ) ; underlying [ i ] . eval ( label , prob ) ; } }
Evaluate the network, with optional metadata

@param labels   Data labels
@param predictions        Network predictions
@param recordMetaData Optional; may be null. If not null, should have size equal to the number of outcomes/guesses