Skip to content
CampusEduX

Problem 1: Calculate and Plot a Basic ROC Curve

Easypython
Learn the Concept: ROC-AUC Curve

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().

Related Problems

  • Problem 2: Calculate AUC for Two Different Models
    Easy · python
    Solve Problem
  • Problem 3: Calculate TPR and FPR at a Specific Threshold
    Easy · python
    Solve Problem
  • Problem 4: Compare AUC Across Different Feature Sets
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...