ProblemCancer is a deadly disease that requires better diagnostics. Early detection improves skin cancer survival. Due to skin lesion dissimilarity, automated image categorization for skin cancer is problematic, making early diagnosis costly and complicated. ObjectiveThis study proposes a deep hidden feature and ensemble classifier skin cancer detection and classification technique. It handles real-time data streaming prediction and dimensionality issues. MethodsThe research work employs the sand cat swarm optimization with ResNet50 (SCSO-ResNet50) method to separate deep hidden features from known features, ensuring accurate predictions. They utilize an improved harmony search (EHS) approach to optimize features and reduce data dimensionality. Ensemble classifiers, including Naive Bayes, random forest, k-nearest neighbor (k-NN), support vector machine (SVM), and linear regression, are used for early cancer diagnosis. The performance of the proposed methodology is evaluated using the Kaggle skin cancer dataset and the ISIC 2019 dataset, comparing it to state-of-the-art classifiers in terms of accuracy, precision, recall, and F-measure. ResultsIn the second layer of skin cancer classification, the ensemble classifiers, baseline classifier, and CNN outperformed each other, improving prediction accuracy. ConclusionThe proposed methodology improved prediction accuracy compared to state-of-the-art classifiers, as evaluated on benchmark datasets. These findings highlight the potential of the suggested approach in enhancing the early diagnosis of skin cancer.