public static double toClassifierPrediction ( Vector vector ) { double max = Double . NEGATIVE_INFINITY ; int maxIndex = 0 ; for ( int i = 0 ; i < vector . size ( ) ; i ++ ) { double curr = vector . apply ( i ) ; if ( curr > max ) { maxIndex = i ; max = curr ; } } return maxIndex ; }
This is for the edge case where you have a single output layer and need to convert the output layer to an index