F-Beta Score

Overview

Computes the F-Beta score for the entire dataset. The F-Beta score is a weighted harmonic mean of precision and recall.

Beta is a parameter that controls the relative weight of precision and recall. A beta of 1 means precision and recall are equally important. A beta greater than 1 emphasizes recall, while a beta less than 1 emphasizes precision.

Formula

Fbeta = (1 + beta^2) * (precision * recall) / ((beta^2 * precision) + recall)

Usage

Manually

# Calculate F-1 score for all data

f1_all = fb_score(df, labels, positive_label, y_true, beta=1)
print("F-1 Score:", f1_all)

Using Fairness Object

result = fo.compute(fb_score, beta=1)

Results

F-1 Score: 0.4210526315789474

These results are obtained by using the input data given in the Create Example Data page under Getting Started

Interpretation

In general, higher values of the F-beta score indicate better model performance, with a value of 1 indicating perfect precision and recall, and a value of 0 indicating poor performance.