Skip to content
C

Problem 1: Calculate and Plot a Basic ROC Curve

Easypython

Problem Description

Write a Python program that trains a Logistic Regression model, calculates the ROC curve, and plots it alongside the random-guessing diagonal line.

Input

A labeled dataset suitable for binary classification.

Output

A displayed ROC curve plot with AUC labeled.

Constraints

  • At least 8 labeled examples.

Example Input

text
X=[[1],[2],[3],[4],[5],[6],[7],[8]], y=[0,0,0,0,1,1,1,1]

Example Output

text
(A plotted ROC curve with the AUC score shown in the legend)

Concepts Covered

roc_curve(), roc_auc_score(), plt.plot().

Input (stdin)

Output

Run your code to see output here...