Early and precise prediction of skin cancer risk is essential for appropriate clinical intervention and better patient outcomes. Various methods have been propositioned for this prediction. In this study, a comprehensive machine learning system is suggested to be used for the classification of skin cancer diseases. The suggested system contains ensemble learning with some of the machine learning algorithms such as Logistic Regression (LR), K-Nearest Neighbours, Decision Tree, Extra Tree and Multi-Layer Perceptron (MLP). The soft voting ensemble and CatBoost classifier combines these enhanced base learners to improve classification performance. To overcome data imbalance, the Synthetic Minority Over-sampling Technique (SMOTE) is used, and each model's hyperparameters are fine-tuned via Bayesian optimization. The models showed varied levels of performance, with Extra Tree having the greatest accuracy of 95%, followed by MLP at 93% and KNN at 91%. Decision Tree and Logistic Regression demonstrated reasonable accuracy of 87% and 82%, respectively. Confusion matrix examination revealed that some models, despite having lower accuracy, had a high sensitivity in identifying affirmative cases. The performance of most models improved after applying Bayesian optimization. Extra Tree had the highest accuracy of 97%, while MLP, KNN, and Decision Tree were close behind with 94%, 91%, and 90% accuracy, respectively. Logistic Regression achieved 81% accuracy but had the highest precision. Confusion matrix analysis indicated that optimization improved model performance, reducing incorrect classifications and enhancing class separation.