How to build a logistic regression model and the ROC curve?

How to build a logistic regression model and the ROC curve?

Create training and test sets with 40% (or 0.4) of the data used for testing. Use a random state of 42. This has been done for you. Instantiate a LogisticRegression classifier called logreg. Fit the classifier to the training data and predict the labels of the test set. Compute and print the confusion matrix and classification report.

Is there a threshold for false positives on the ROC curve?

The threshold comes relatively close to the same threshold you would get by using the roc curve where true positive rate (tpr) and 1 – false positive rate (fpr) overlap. This tpr (cross) 1-fpr cross maximizes true positive while minimizing false negatives. Following Will’s comment.

How to choose the correct threshold in logistic regression?

I built a logistic regression model. How can I choose the optimal threshold by looking at the ROC? I want to be able to make the decision if the observation has the event.

What does AUC stand for in logistic regression?

Just by glancing over the graph, we can conclude that threshold C is better than threshold B and depending on how many False Positives that we are willing to accept, we can choose the optimal threshold. AUC stands for Area under the curve. AUC gives the rate of successful classification by the logistic model.

What are the parameters of a logistic regression?

The logistic regression model assumes that: The model parameters are the regression coefficients , and these are usually estimated by the method of maximum likelihood. For given values of the model covariates, we can obtain the predicted probability .

Where does the ROC curve go with one covariate?

This is because with just one covariate the fitted probabilities are a monotonic function of the only covariate. However in general (i.e. with more than one covariate in the model), this won’t be the case. Previously we said that a model with good discrimination ability, the ROC curve will go close to the top left corner.

Where does the ROC curve go in a discrimination model?

A model with high discrimination ability will have high sensitivity and specificity simultaneously, leading to an ROC curve which goes close to the top left corner of the plot. A model with no discrimination ability will have an ROC curve which is the 45 degree diagonal line.