F-Score Calculation for Binary Classification
Core Metrics DS practice problem on Onlearn.
Difficulty: medium.
Topics: F-Score Calculation for Binary Classification, Harmonic Mean, Precision-Recall Tradeoff, Beta Parameter Tuning, True Positive Rate, False Discovery Rate, Model Evaluation & Selection, Statistical Inference, Information Theory, Supervised Learning, Data Quality Assessment, Classification Performance Metrics, Confusion Matrix Analysis, Cost-Sensitive Learning, Imbalanced Data Handling, Hypothesis Testing.
Task: Implement F Score Calculation for Binary Classification Your task is to implement a function that calculates the F Score for a binary classification task. The F Score combines both Precision and Recall into a single metric, providing a balanced measure of a model's performance. Write a function f score(y true, y pred, beta) where: y true: A numpy array of true labels (binary). y pred: A numpy array of predicted labels (binary). beta: A float value that adjusts the importance of Precision and Recall. When beta=1, it computes the F1 Score, a balanced measure of both Precision and Recall. The function should return the F Score rounded to three decimal places.