example, regression models make predictions that answer questions like the following: • What is the value of a house in California? • What is the probability that a user will click on this ad? A classification model predicts discrete values. For example, classification models make predictions that answer questions like the following: • Is a given email message spam or not spam? • Is this an image of a dog, a cat, or a hamster?
pursuing M.S. in Artificial Intelligence at UGoog. My GRE Score is 315 and I fancy my chances of getting in. As a prospective graduate student, I start browsing through the GRE scores of students that had been admitted to UGoog and those which were rejected. I could predict my chances through regression model. Unless the graph looks…...
as output. Logistic regression is an extremely efficient mechanism for calculating probabilities. You might be wondering how a logistic regression model can ensure output that always falls between 0 and 1. As it happens, a sigmoid function, defined as follows, produces output having those same characteristics:
w 1 , and we take a log loss function- The weights are then updated by the log loss until the the log loss converges to almost 0. My regression model now gives a probability of my acceptance at UGoog as an output.
can use the returned probability as it is or convert the returned probability to a binary value. How do we convert a regression model to a classification model? In order to map a logistic regression value to a binary category, you must define a classification threshold (also called the decision threshold). A value above that threshold indicates class A; a value below indicates class B. It is tempting to assume that the classification threshold should always be 0.5, but thresholds are problem-dependent, and are therefore values that you must tune. How can one determine a good decision threshold?
there are four possible outcomes • A true positive is an outcome where the model correctly predicts the positive class. Similarly, a true negative is an outcome where the model correctly predicts the negative class. • A false positive is an outcome where the model incorrectly predicts the positive class. And a false negative is an outcome where the model incorrectly predicts the negative class.
which seems great!! Let’s take a closer look. • Of the 100 tumor examples, 91 are benign (90 TNs and 1 FP) and 9 are malignant (1 TP and 8 FNs). • Of the 91 benign tumors, the model correctly identifies 90 as benign. That's good. However, of the 9 malignant tumors, the model only correctly identifies 1 as malignant—a terrible outcome, as 8 out of 9 malignancies go undiagnosed! • In other words, our model is no better than one that has zero predictive ability to distinguish malignant tumors from benign tumors. Accuracy alone doesn't tell the full story when you're working with a class-imbalanced data set, like this one, where there is a significant disparity between the number of positive and negative labels. Hence we need better metrics.
model correct when it predicted a positive class?” Recall: Recall attempts to answer: “Out of all the possible positive class outcomes, how many did the model correctly identify?” Precision and recall are often in tension. That is, improving precision typically reduces recall and vice versa.
a graph showing the performance of a classification model at all classification thresholds. This curve plots two parameters- True Positive Rate (TPR) is a synonym for recall and is therefore defined as follows: False Positive Rate (FPR) is defined as follows: An ROC curve plots TPR vs. FPR at different classification thresholds. Lowering the classification threshold increases False Positives and True Positives, though typically not to the same degree.
an ROC curve, we could evaluate a logistic regression model many times with different classification thresholds, but this would be inefficient. Fortunately, there's an efficient, sorting-based algorithm that can provide this information for us, called AUC (Area under the ROC Curve).
ROC curve from (0,0) to (1,1). One way of interpreting AUC is as the probability that the model ranks a random positive example more highly than a random negative example. AUC ranges in value from 0 to 1. A model whose predictions are 100% wrong has an AUC of 0.0; one whose predictions are 100% correct has an AUC of 1.0.
two reasons: • AUC is scale-invariant. It measures how well predictions are ranked, rather than their absolute values. • AUC is classification-threshold-invariant. It measures the quality of the model's predictions irrespective of what classification threshold is chosen. Disadvantages: • Scale invariance is not always desirable. For example, sometimes we really do need well calibrated probability outputs, and AUC won’t tell us about that. • Classification-threshold invariance is not always desirable. In cases where there are wide disparities in the cost of false negatives vs. false positives, it may be critical to minimize one type of classification error. For example, when doing email spam detection, you likely want to prioritize minimizing false positives (even if that results in a significant increase of false negatives). AUC isn't a useful metric for this type of optimization.