Created
July 5, 2017 12:18
-
-
Save Steppschuh/ac73dd53f8189f186867c79aecb91f96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static float calculateF1Score(float precision, float recall) { | |
return calculateFScore(1, precision, recall); | |
} | |
public static float calculateFScore(double beta, float precision, float recall) { | |
return (float) (1 + Math.pow(beta, 2)) * ((precision * recall) / (precision + recall)); | |
} | |
public static float calculatePrecision(int truePositives, int falsePositives) { | |
return truePositives / (float) (truePositives + falsePositives); | |
} | |
public static float calculateRecall(int truePositives, int falseNegatives) { | |
return truePositives / (float) (truePositives + falseNegatives); | |
} | |
public static float calculateAccuracy(int truePositives, int trueNegatives, int realPositives, int realNegatives) { | |
return (truePositives + trueNegatives) / (float) (realPositives + realNegatives); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment