This topic is under machine learning and our interest is to know what is the probability that a link on our website will be clicked with information provided from a machine learning algorithm. So here is the  scenario,

Suppose that we have created a machine learning algorithm that predicts whether a link will be clicked with 99% sensitivity and 99% specificity. The rate the link is clicked is 1/1000 of visits to a website. If we predict the link will be clicked on a specific visit, what is the probability it will actually be clicked?

we will compute the probability using R.

Assume there are 100000 visits. That assumption is based on 1000 * 100 from 1/1000 rate given.

we know sensitivity is 99% so True Positive = 99 and False Negative = 1

what we are being asked is positive predictive value (PPV), which is, what is the probability a click happens in a specific visit, given that the predicted outcome is positive. That is given by the formula PPV = TP /(TP+FP)
where PPV is the Positive predictive value, TP is the True positive which means we predicted there will be a click and it actually happend and FP is the false positive which means we predicted there will be a click but it didn’t happen.

lets do the computation in R

TP <- 99 
FN <- 1 # population=100000 => FP+TN=99000 
# specificity=99% => TN=0.99*99000=98901, therefore FP=999 
TN <- 0.99 * 99900 
FP <- 99900 - TN 
PPV <- TP / (TP + FP) 
PPV

Code run shapshot is shown below.

This means we have 9% chance that the link will be clicked on a given visit.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *