Problem 1: Calculate All Four Metrics
Easypython
Learn the Concept: Accuracy, Precision, Recall, F1-ScoreProblem 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
textactual=[1,0,1,1,0], predicted=[1,0,0,1,0]
Example Output
textAccuracy: 0.8 Precision: 1.0 Recall: 0.67 F1-Score: 0.8
Concepts Covered
accuracy_score(), precision_score(), recall_score(), f1_score().
Related Problems
- Problem 2: Manually Calculate TP, TN, FP, FNEasy · pythonSolve Problem
- Problem 3: Compare Precision and Recall on an Imbalanced DatasetEasy · pythonSolve Problem
- Problem 4: Calculate F1-Score ManuallyEasy · pythonSolve Problem