public ReliabilityDiagram getReliabilityDiagram ( int classIdx ) { INDArray totalCountBins = rDiagBinTotalCount . getColumn ( classIdx ) ; INDArray countPositiveBins = rDiagBinPosCount . getColumn ( classIdx ) ; double [ ] meanPredictionBins = rDiagBinSumPredictions . getColumn ( classIdx ) . castTo ( DataType . DOUBLE ) . div ( totalCountBins . castTo ( DataType . DOUBLE ) ) . data ( ) . asDouble ( ) ; double [ ] fracPositives = countPositiveBins . castTo ( DataType . DOUBLE ) . div ( totalCountBins . castTo ( DataType . DOUBLE ) ) . data ( ) . asDouble ( ) ; if ( excludeEmptyBins ) { val condition = new MatchCondition ( totalCountBins , Conditions . equals ( 0 ) ) ; int numZeroBins = Nd4j . getExecutioner ( ) . exec ( condition ) . getInt ( 0 ) ; if ( numZeroBins != 0 ) { double [ ] mpb = meanPredictionBins ; double [ ] fp = fracPositives ; // FIXME: int cast meanPredictionBins = new double [ ( int ) ( totalCountBins . length ( ) - numZeroBins ) ] ; fracPositives = new double [ meanPredictionBins . length ] ; int j = 0 ; for ( int i = 0 ; i < mpb . length ; i ++ ) { if ( totalCountBins . getDouble ( i ) != 0 ) { meanPredictionBins [ j ] = mpb [ i ] ; fracPositives [ j ] = fp [ i ] ; j ++ ; } } } } String title = "Reliability Diagram: Class " + classIdx ; return new ReliabilityDiagram ( title , meanPredictionBins , fracPositives ) ; }
Get the reliability diagram for the specified class