## 1 Introduction  
Skin cancer is the most common type of cancer in the United States. Doctors and patients have given importance to the observation of second primary cancers (SPCs) with caution [1]. In Taiwan, early detection and diagnosis have become feasible owing to the promotion of cancer screening in recent years. With improvements in computing capacity, artificial intelligence (AI) has been gaining attention in the medical field. Machine learning (ML), a component of AI, plays a key role in assisting diagnosis and prognosis. In 1994 [2], [PERSON] et al. utilized artificial neural networks (NN) to distinguish melanoma from the other three skin tumors, i.e., benign pigmented tumors, and achieved promising performance. Moreover, in 1998 [3], they combined a hierarchical neural network and fuzzy system to diagnose skin cancer with 23 features extracted from raw images and achieved excellent results. Nevertheless, the literature on the prediction of second cancers in skin cancer survivors is still inadequate. Since then, an increasing number of machine learning and deep learning technologies have exploded in the field of artificial intelligence. [PERSON] et al. used an SVM ensemble classification approach to identify melanoma images [4]. [PERSON] et al. combined deep learning (CNN), sparse coding, and support vector machine (SVM) learning algorithms for melanoma recognition [5]. According to [PERSON] et al., deep learning techniques permeated the field of medical image analysis [6]. [PERSON] et al. demonstrated that pre-trained and transfer learning models are applicable to medical images [7]. [PERSON] et al. [8] highlighted the importance of including additional factors in the model that can allow improved cost-effective screening strategies for skin cancer through their model. In our study, we consider the random forest algorithm [9] to develop a classifier and benchmark MLP, C4.5 [10], AdaBoost [11], and bagging [12] algorithms, using several metrics. Additionally, we leverage synthetic minority over-sampling techniques (SMOTE) [13] to solve the issue of unbalanced datasets, cost-sensitive learning for risk assessment, and Shapley additive explanations (SHAP) [14; 15; 16] for the analysis of relevant characteristics considering global and local perspectives. Random forest is a type of ensemble machine-learning model based on classification and regression trees (CART), bagging (bootstrap [17] aggregation), and random feature selection. This randomness design prevents the overfitting of other decision trees and possesses tolerance against noise and outliers. The important feature of random forests is the permutation approach, which helps measure the decrease in prediction performance as we permute the value of the feature. We have summarized the current state of cancer diagnostics in Table A1 of Appendix A.  
SMOTE is an oversampling algorithm proposed by [PERSON] et al. used to improve overfitting. This algorithm helps create new randomly generated samples between minority class samples and their neighbors, which can balance the number among categories. Cost-sensitive [18; 19; 20] learning is a training approach that considers the assigned costs of misclassification errors during model training. This is closely related to an imbalanced dataset study. Different biases are required, with different monitoring criteria in different risk management phases. The computing speed of random forest is efficient; thus, we can easily integrate different cost biases for scenarios of interest to obtain an overall picture. The SHAP analysis is an extension based on Shapley values and a game-theoretic method to calculate the average of all marginal contributions in all the coalitional combinations. In addition to the calculation of Shapley values, SHAP addresses the additive feature attribution as a linear model. For a given feature set, the SHAP values are calculated for each feature and then added, considering a base value to perform the final prediction.