Drilling optimization has been broadly developed in terms of influential parameters. The assessment time and the effects of both geomechanical and drilling parameters were vital challenges of investigations. Drilling factors are applied force or rotation of drilling agents such as weight on bit (WOB), and geomechanical features represent mechanical indexes of rocks including unconfined compressive strength (UCS). Optimization efforts have been demonstrated on complex prediction methods whereas the simplicity of classification can offer some optimal ranges utilizing machine learning classifications in an accelerated process. In this study, a novel procedure using the supervised and semi-supervised learning approaches was conducted to classify and optimize the rate of penetration (ROP) and torque on bit (TOB). Firstly, in the case well, user-defined classes were assigned based on geomechanical units (GMU) and the ranges of high ROP and low TOB, thus classes divided drilling factors as GMUs of the case. Secondly, the feature selection was carried out by neural pattern recognition with three multi-objective optimization methods for classification. The inputs of classifications were WOB, hook load, pump pressure, flow rate, UCS, and internal friction angle. Classification approaches were decision trees, support vector machine (SVM), and ensemble learning. Finally, the bagged trees permutation and Laplacian SVM (LapSVM) algorithm separately revealed the significance of parameters and predicted the optimal ROP and TOB regions. Findings showed (1) in supervised classification of the case well, the cubic SVM and bagged trees had the highest area under the curve (AUC) and accuracy, on average 0.97 and 0.96, respectively. (2) The average accuracy of the supervised classifications in a test well was 91% except for the fine SVM, which makes them reliable for the fields with the least information. (3) The permutation outcomes for significant features, flow rate and UCS, exposed influential parameters for ROP and TOB optimization. (4) The semi-supervised method, LapSVM, not only acquired both ROP and TOB labels with an accuracy of 88% but also presented their optimal ranges in 95% of the assessed zones. (5) LapSVM deals with a limited training section perfectly opposed to the supervised version, which is vital for drilling investigation. (6) Implementing machine learning classification approaches with rock properties is a key factor in achieving effective drilling parameters in less time. More importantly, the recommended drilling factors concerning geomechanical properties can ameliorate both drilling performance and perception of upcoming collapse.