01/15/2018
Depending on the situation, the simple “number of correct classifications” error metric might not be the best metric to use in binary classification. Here, we explore several metrics and how they might be used for different problems.
In binary classification, it is common practice to label the “afflicted” case as a 1. For example, if we try to predict whether an individual has cancer or not, we would label our training data with a 1 if the unit is afflicted with cancer. This isn’t too big of a deal as long as you’re clear, but the statistics in the following section make more intuitive sense with this convention.
There are $2^2 = 4$ binary classification statistics to consider.
A true positive is a classification where $\hat{y} = 1$ and $y = 1$. That is, the model predicts the positive case (1) correctly.
A false positive is a classification where $\hat{y} = 1$ and $y = 0$. The model makes a positive prediction even though the true class is negative. This is also known as Type-I error.
A false negative occurs when $\hat{y} = 0$ and $y = 1$. Here, the model predicts the negative case, even though the sample is actually a positive case. This is also known as Type-II error.
A true negative occurs when both $\hat{y}$ and $y$ are 0. The model successfully classifies a sample in the negative case.
With these statistics, we can then define detection metrics.
There are several metrics that can be used to measure the efficacy of your model:
Accuracy is the most intuitive metric you might use. It’s simply the proportion of correct classifications into either class:
\[\textit{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN}\]This is a reasonable metric to use when both classes are equally important.
The True Positive Rate (TPR), also known as the sensitivity, is a measurement of how sensitive our model is to positive cases:
\[TPR = \frac{TP}{TP + FN}\]If we are predicting whether units have diseases or not, we might want a sensitive model so we do not miss any cases. If the sensitivity is low, the test wouldn’t be a strong indicator of the disease.
We would like the FPR to be as low as possible, meanig
The True Negative Rate (TNR), also known as the specificity, is a measurement of units correctly classified into the negative case out of all units in the negative case.
\[TNR = \frac{TN}{FP + TN}\]If our specificity is low, then our model might be incorrectly classifying everyone as the positive case, which would be uninformative.
We might want to consider both how often we correctly mark something as the positive case in addition to its sensitivity. We can then use a metric based on precision and recall. Precision is defined as the fraction of correct positive cases:
\[P = \frac{TP}{TP + FP}\]Recall (R) is the fraction of cases marked as positive, also known as the sensitivity of TPR.
The F1-Score or F-Score is known as the harmonic mean of precision and recall:
\[F_1 = 2\frac{P\cdot R}{P+R}\]With these metrics, it’s up to the data scientist to decide which metrics are the most important to report depending on the experiment being run.
08/22/2018
Toward the Light: Behind the Scenes
07/01/2018
Arch Linux: Chromebook C720 Webcam Microphone Disappeared
06/21/2018
SSH: How to Set Up a Simple Local Media Server
02/28/2018
Pacman: File Conflicts
01/17/2018
Making an Arch Linux USB Flash Install Medium
01/17/2018
Arch Linux: Post-Install Notes
01/15/2018
Binary Classification Metrics
01/14/2018
Probabilitistic Classification
01/09/2018
Classification and Perceptron
01/08/2018
Linear Regression: Bayesian Approach, Normal Conjugacy
01/08/2018
Nonlinearity: Basis Functions
01/04/2018
Linear Regression: A Probabilistic Approach
12/30/2017
Linear Regression: A Mathematical Approach
12/20/2017
2017 Reflections: A Year of Curating
12/19/2017
Introduction to Regression: K-Nearest Neighbors
12/18/2017
Welcome to my Miscellaneous Blog!
12/18/2017
A Definitive Arch Linux Install Guide for the Chromebook C720
10/01/2017
C4D: Volume Effector
09/18/2017
Algorithms: Maximum Sliding Window
09/10/2017
Introduction to Inference: Coins and Discrete Probability
09/05/2017
C4D: Unreliable Booles
08/30/2017
Welcome to my Tech Blog!
08/30/2017
Welcome to my Problem Solving Blog!
Previous: Probabilitistic Classification | Next: Arch Linux: Post-Install Notes