arXiv:2610.06139cs.AIOct 2026

Manuscript Offprint

arXiv:2610.06139

On Impact of Loss Function on the Performance of Neural Networks in Melanoma Diagnosis

Morgan May, Pierpaolo Dondio, Simon Caton

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Morgan May 1,4^{1,4}[0009-0006-1953-7600], Pierpaolo Dondio 2^{2}[0000-0001-7874-8762], and Simon Caton 3^{3}[0000-0001-9379-3879]

1^{1} Technological University Dublin, Dublin, Ireland

2^{2} Dublin City University, Dublin, Ireland

3^{3} University College Dublin, Dublin, Ireland

4^{4} Research Ireland Centre for Research Training in Machine Learning, ML-Labs, Dublin, Ireland

simon.caton@ucd.ie

Abstract. Melanoma is the deadliest type of skin cancer, whose early diagnosis is crucial for patients' survival. Image classification using deep learning models has shown promising results for melanoma diagnosis. However, the performance of these models on the melanoma datasets such as SIIM-ISIC melanoma classification dataset is a challenge due to the class imbalance. One of the methods to deal with this challenge is using loss function modifications. In this work, we have investigated the effect of different loss functions on the performance of deep neural networks. We trained these networks using focal loss, logit-adjusted softmax cross-entropy (CE) loss, and weighted softmax CE loss, and we report different metrics for evaluating performance and uncertainty calibration. Our results suggest that focal loss delivers a good combination of performance in terms of AUC and uncertainty calibration in terms of expected calibration error (ECE) simultaneously.

Keywords: Melanoma diagnosis · image classification · imbalanced data · loss function · model performance · uncertainty calibration.

1 Introduction

Skin cancer is a common skin disease whose incidence and mortality rates have been showing yearly increases. Early diagnosis and timely treatment of skin cancer, especially for its deadliest form, malignant melanoma, remain a critical clinical issue globally [20][20]. Recently, deep learning has revolutionised melanoma diagnosis by building highly accurate classification models [2,5,8,10,13][2,5,8,10,13].

Melanoma diagnosis is an imbalance classification task, where in the available clinical datasets, the number of positive samples (malignant) is outnumbered by the negative samples (benign), because of the data scarcity of malignant cases. Imbalanced data poses a challenge for generalization on minority classes and makes naive learning biased towards the majority classes [11][11]. The methods to cope with this challenge can be divided into four groups [3][3]: data-level, algorithmic-level, hybrid of both and ensemble learning. One of the algorithmic level approaches is loss function modifications [1,4,9,11][1,4,9,11].

Authors in [14] compared the effect of focal loss [9], weighted cross-entropy (CE) loss [16], and large margin-aware focal (LMF) loss [17] on the performance of EfficientNet-B3 on melanoma classification. They report the results with careful hyperparameter tuning and show that LMF loss delivers higher AUC compared to focal loss and weighted CE. In this work, we investigate the effect of different loss functions, including focal loss [9], logit adjusted softmax cross-entropy loss [11], and balanced softmax cross-entropy loss [15], on the performance of EfficientNet-B0, EfficientNet-B2, and EfficientNetV2-S by performing hyperparameter tuning using grid search, for each of the combinations of loss functions and models, and incorporating the evaluation of model uncertainty calibration.