Skip to content
C

Problem 1: Calculate All Four Metrics

Easypython

Problem Description

Write a Python program that calculates Accuracy, Precision, Recall, and F1-Score for a given set of actual and predicted labels using Scikit-learn.

Input

Two lists: actual labels and predicted labels.

Output

All four calculated metrics.

Constraints

  • Both lists must have the same length, containing binary (0/1) values.

Example Input

text
actual=[1,0,1,1,0], predicted=[1,0,0,1,0]

Example Output

text
Accuracy: 0.8 Precision: 1.0 Recall: 0.67 F1-Score: 0.8

Concepts Covered

accuracy_score(), precision_score(), recall_score(), f1_score().

Input (stdin)

Output

Run your code to see output here...