Abstract
Skin cancer is a serious public health challenge, and early diagnosis is crucial for effective treatment. We present a machine-learning pipeline to classify patients as “Cancer” vs “Non-Cancer” using clinical and demographic features. The study uses a real-world dataset ($\mathbf{n}=\mathbf{7 0 4}$) with 20 predictors (age, gender, lesion site, lifestyle factors, etc.) and an extremely imbalanced target (696 non-cancer vs 8 cancer cases), fortunately, due to less cancer patients observed in India. We perform thorough preprocessing (including handling missing values and categorical encoding), exploratory data analysis, and compare five classifiers: Logistic Regression, Random Forest, Gradient Boosting, Support Vector Machine (RBF kernel), and K-Nearest Neighbors. A stratified 5-fold cross-validation ensures reliable model comparison and overfitting control. The best model (Logistic Regression) achieved near-perfect cross-validated performance (ROC-AUC $\boldsymbol{\approx} \mathbf{1. 0}$) and very high test accuracy $(99.3 \%)$, with precision 66.7% and recall 100% on the rare cancer class. Performance metrics (accuracy, precision, recall, $\text{F1}$, ROC-AUC), confusion matrix, ROC curve, and feature importance (from the tree-based models) are reported. We include visualizations from EDA (class balance, age distribution, lesion site distribution, correlation heatmap) and evaluation (cross-validation bar chart, confusion matrix, ROC curve, and feature importances). The study highlights the predictive power of routine clinical features and provides insights for interpretable skin cancer risk assessment using SHAP and LIME.