How to decide optimal threshold for my classification model from FPR, TPR and threshold I am building my model in Python to classify customer in buyer/ non-buyer category. I used mutiple agorithms for this problem and then after evaluation selecting the best out of all. 

sklearn package in python gives me an array of FPR,TPR and threshold for all my predicted records.

While analyzing the value of FPR,TPR and threshold I got confused how to interpret threshold value. I am getting threshold value for each record. 

For example: My testing dataset consist of 100 records tehn I got array of size 100 for TPR,FPR and threshold.

How to decide the optimium threshold for my model using these values??

from sklearn import metrics
fpr, tpr,threshold = metrics.roc_curve( Y_test, status[:,1])
I’m willing to bet that you have a 100 value array for both the ROC and the data by coincidence. You aren’t getting a threshold for each data record but for each threshold evaluated. 

At this point, you have to define what ‘optimal’ means in your context. By default (in many R packages at least), sensitivity and specificity are equally weighted, in which case the ‘optimal’ threshold corresponds roughly to the threshold where a 45 degree tangent line intersects the ROC curve. You can choose any threshold you want for a given ROC, depending on how you weight sense/spec.  R has a few packages that help compute that; I’d be surprised if Python did not have an equivalent.