A Surrogate Loss Function for Optimization of F Score in Binary Classification with Imbalanced Data

Namgil Lee*, Heejung Yang and Hojin Yoo

The Fβ score is a commonly used measure of classification performance, which plays crucial roles in classification tasks with imbalanced data sets. However, the Fβ score cannot be used as a loss function by gradient-based learning algorithms for optimizing neural network parameters due to its non-differentiability. On the other hand, commonly used loss functions such as the binary cross-entropy (BCE) loss are not directly related to performance measures such as the Fβ score, so that neural networks optimized by using the loss functions may not yield optimal performance measures. In this study, we investigate a relationship between classification performance measures and loss functions in terms of the gradients with respect to the model parameters. Then, we propose a differentiable surrogate loss function for the optimization of the Fβ score. We show that the gradient paths of the proposed surrogate Fβ loss function approximate the gradient paths of the large sample limit of the Fβ score. Through numerical experiments using ResNets and benchmark image data sets, it is demonstrated that the proposed surrogate Fβ loss function is effective for optimizing Fβ scores under class imbalances in binary classification tasks compared with other loss functions.