public static PredictionOutcomePair from(int outcomeClass, double prediction) { Preconditions.checkArgument(outcomeClass == 0 || outcomeClass == 1, "Outcome class must be 0 or 1! Supplied: " + outcomeClass); return new PredictionOutcomePair(outcomeClass, prediction); }
int numOnes = 0; for (PredictionOutcomePair tuple : outcomePredictedPairs) { if (tuple.getOutcomeClass() == 1) { numOnes++; long truePos = tp0 = numOnes; long accum = tn = 0; double threshold = outcomePredictedPairs.get(0).getPrediction(); for (int i = 0; i < n; i++) { double actualValue = outcomePredictedPairs.get(i).getOutcomeClass(); double predictedValue = outcomePredictedPairs.get(i).getPrediction(); if (predictedValue != threshold) { // threshold changes threshold = predictedValue;
threshold, result, outcomeVector, predictedVector); outcomePredictedPairs.add(PredictionOutcomePair.from(outcomeClass, predictedVector.get(0)));