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 weights Recall relative to Precision (beta > 1 favours Recall, beta < 1 favours Precision). When beta=1, it computes the F1-Score, a balanced measure of both Precision and Recall.With Precision and Recall (each taken as 0 when its denominator is 0):
The function should return the F-Score rounded to three decimal places, or 0.0 when .