Unconfined compressive strength prediction of rock materials based on machine learning

It is costly, time-consuming, and difficult to measure unconfined compressive strength (UCS) using typical laboratory procedures, particularly when dealing with weak, extremely porous, and fractured rock. By efficiently choosing the variables from a sub-set of the dataset that includes the Schmidt hammer rebound number (SRn), bulk density (BD), bulk tensile strength (BTS), dry density (DD) test, p-wave velocity test (Vp), and point load index test (Is(50)), this study seeks to establish predictive models for the UCS of rocks. A prediction model for UCS was prepared using K-nearest neighbor (KNN). KNN was preferred over machine learning algorithms because it is simple, versatile, and interpretable. It is particularly useful when it has limited training time, faces non-parametric data with changing distributions, or requires straightforward explanations for predictions. In order to improve KNN’s prediction performance in this research, two optimization procedures (namely, Alibaba and the Forty Thieves (AFT) and Improved Manta-Ray Foraging Optimizer (IMRFO)) were used. Through comparison of KNN single modal performance with that of optimized versions, it is concluded that the KNIM (KNN model optimized with IMRFO) is an excellent possible applicant for the forecast of the UCS of rocks. This study’s results showed that the KNIM model is more suitable than the KNN single model and its counterpart KNAF in terms of accuracy as its correlation of determination ( R 2 ) values were 1.1% and 2% higher than KNN and KNAF and its root mean squared error (RMSE) values were 37.9% and 43.7% lower than KNN and KNAF. The improvement in R 2 and RMSE values for the KNIM model compared to KNN and KNAF is highly significant for the reliability and accuracy of the predictive model. R 2 , measuring the proportion of variance predictable in the dependent variable (UCS of rocks) from the independent variables (model predictions), signifies a better fit to observed data. The elevated R 2 values for KNIM indicate a stronger correlation with actual UCS values, enhancing the model’s accuracy in representing underlying patterns. Additionally, the reduction in RMSE values for KNIM implies that its predictions are, on average, closer to actual UCS values, contributing to a more accurate and reliable estimation of rock strength.


Introduction
One of the most important metrics for determining a rock's ability to support weight is its unconfined compressive strength (UCS) .Inaccurate UCS calculations can be hazard- ous as they diminish the final bearing capacity.Rock strength is typically determined through unconfined compression tests in laboratories, following established procedures like those charted by the International Society for Rock Mechanics (ISRM) .However, various challenges exist in directly measuring UCS in the lab, notably in obtaining suitable rock core specimens, particularly for rocks that are severely fractured and have a lot of lamination and foliation [1,2].Determining UCS directly in the early design stages is costly and time-consuming [3].Nevertheless, alternative methods, such as regression models and machine learning techniques, offer viable options for predicting rock strength.
Numerous researchers have attempted to establish standardized methods for assessing UCS.Various techniques for predicting UCS fall into categories such as simple regression, where UCS is correlated with parameters derived from basic index tests for rocks.These tests encompass the tests for the Schmidt hammer, ultrasonic velocity (Vp) , point- load index, Brazilian tensile strength, and slake durability index [4][5][6].Multiple regression analysis has also been successfully employed to predict rock strength.However, it has been noted in some reports that these relationships may not consistently yield highly reliable UCS values.The clarification is that the correlation is not directly with UCS but involves parameters derived from these tests, as exemplified by not correlating UCS with the slake durability test but rather with the slake durability index [7].Commonly, it is recommended to use these equations for specific rock types.Furthermore, these analytical prediction techniques cannot adapt to changes in data.Consequently, the equations require updating if new data is introduced [8][9][10].
Previous studies have applied machine learning (ML) techniques to predict UCS [19].Meulenkamp and Grima used a backpropagation artificial neural network (ANN) on various rock samples and found it outperformed traditional statistical methods [20].Sonmez et al. applied a fuzzy inference system (FIS) to agglomerate samples of Ankara, yielding highly reliable UCS predictions [21].Gokceoglu and Zorlu used regression and fuzzy models on problematic rocks, with the fuzzy model performing desirable for UCS estimation [22].Dehghan et al. compared feed-forward regression and neural network models, concluding that ANN is a more robust model for the estimation of UCS [23].Mishra and Basu found FIS and multiple regression approaches more efficient than sim- ple regression for UCS prediction [24].Cevik et al. reported the efficiency of ANN for sedimentary rock samples [25].Yesiloglu-Gultekin et al. favored the adaptive neurofuzzy inference system (ANFIS) over multiple regression and ANN [26].Skentou et al. [27] explored the prediction of UCS in granite by employing three ANN-based models.The study used three non-destructive test indicators on a collected dataset consisting of 274 entries: pulse velocity, Schmidt-hammer rebound number, and effective porosity.
Three ANN models were trained and validated: ANN-LM (built using the Levenberg- Marquardt method), ANN-PSO (ANN and particle swarm optimization), and ANN-ICA ( ANN and imperialist competitive algorithm).The experimental findings revealed that the ANN-LM model exhibited the highest accuracy, achieving superior predictive per- formance in the validation phase with an R value of 0.9607 and RMSE of 14.8272.Comparative analysis showed that the developed ANN-LM outperformed existing models found in the literature.Additionally, the study developed a graphical user interface (GUI) for estimating UCS in granite using the ANN-LM model, enhancing practical usability.Le et al. [28] employed artificial neural networks to predict the UCS of rocks using a comprehensive database of 367 literature datasets.The study focused on input parameters such as Schmidt hammer number (Rn) , Vp , and effective porosity (ne) .Notably, the developed ANN effectively consolidated different Schmidt hammer numbers, exhibit- ing a correlation with L-type Schmidt hammer numbers within ±20% deviation from experimental data for 97.27% of specimens.Among the soft computing models consid- ered ( ANN-LM, ANN-PSO , and ANN-ICA ), the highest accuracy was achieved with the ANN-ICA model.This model demonstrated strong predictive performance for UCS across various rock types and formation methods, showcasing less than ±20% devia- tion from experimental data for 86.36% of cases.Additionally, the study provided a user- friendly graphical interface, incorporating the closed-form equation of the ANN-ICA model, as supplementary material.Koopialipoor et al. [17] developed a novel system utilizing machine learning models such as k-nearest neighbors (KNN) , multi-layer per- ceptron (MLP) , random forest (RF) , and tree.The optimal model, a stacking-tree-RF- KNN-MLP structure, integrated diverse characteristics from these models to enhance the accuracy of predicting Young's modulus.The refinement process involved optimizing influential parameters within each basic model, resulting in the development of the final model.Rock deformations were predicted using four index tests: porosity, Schmidt hammer, point load strength, and p-wave velocity.The stack-tree-RF-KNN-MLP model achieved the highest prediction accuracy (R 2 = 0.8197 , MSE = 227.371, RMSE = 15.079, and MAE = 12.123).
Moreover, Table 1 shows the summary of some published articles.This study addresses the imperative need for robust prediction models capable of effectively forecasting the UCS of rocks, considering the intricate relationships among various input variables.The choice of utilizing the K-nearest neighbor (KNN) algorithm stems from its intrinsic value as a versatile tool for UCS prediction, offering simplicity and adaptability.The necessity for such models arises from the complex, non-linear relationships exhibited by rocks' UCS concerning diverse geological parameters.KNN, with its instance-based approach, proves advantageous, requiring no extensive training and enabling real-time adaptability to dynamic geological conditions.Additionally, KNN provides a unique insight into feature importance, facilitating the identification of key parameters influencing rock strength.Acknowledging the complex spatial variations in rock properties, KNN's capability to capture both local and global patterns in the data aligns with the study's novel approach to modeling UCS.It serves as a crucial tool for understanding and predicting the spatial nuances of rock strength variations.However, the choice of KNN is underscored by the necessity to consider dataset characteristics and problem complexity, ensuring its suitability as a benchmark for UCS prediction in rock mechanics.The novelty of this study lies in the enhancement of the presented models through the integration of two metaheuristic algorithms: Alibaba and the Forty Thieves (AFT) and Improved Manta-Ray Foraging Optimizer (IMRFO).This innovative approach aims to elevate the predictive performance of the models further, addressing the exigency for improved accuracy and reliability in predicting UCS in highly fractured, porous, and weak rock formations.The objective of the optimization algorithm selection in this study was to elevate the performance of the KNN model in its predictive capacity for the UCS of rocks.In pursuit of this goal, two algorithms, AFT and IMRFO, were deliberately chosen due to their demonstrated efficiency in addressing complex problems.
AFT, known for its exploratory nature, was specifically selected to contribute to the refinement of the KNN model parameters.The algorithm's inherent ability to explore the solution space was deemed advantageous in systematically adjusting the model's configuration to better align with the intricacies of the dataset, thereby enhancing its predictive accuracy for UCS.On the other hand, IMRFO was chosen for its advanced exploration capabilities, with the primary aim of fine-tuning parameters and further improving the overall predictive performance of the KNN model.IMRFO's capacity for comprehensive exploration, considering multiple objectives, was considered a valuable asset in the quest for optimal parameter settings that could significantly elevate the model's efficacy in capturing the underlying patterns governing rock strength.
By strategically combining the strengths of AFT and IMRFO, the study aimed to not only refine the KNN model but also harness the relation between these optimization algorithms to achieve a more robust and accurate predictive framework for UCS in rock mechanics.The thoughtful integration of these algorithms aimed to navigate the complexities inherent in rock strength prediction and contribute to the advancement of reliable modeling techniques in geotechnical applications.
Five statistical indices, which included R 2 , RMSE, MSE, RSR , and FB , were utilized to assess the precision of the models.Finally, the optimal model is introduced to be used in geotechnical applications.

Rock sample data
In geotechnical analysis, critical rock properties encompass physical attributes and strength parameters.These include bulk density (BD), pivotal for UCS measurements by aiding in dry weight calculation; bulk tensile strength (BTS), indicating resistance to tensile forces; dry density (DD) for assessing soil compaction quality; p-wave velocity test (Vp) for measuring seismic wave speed; Schmidt hammer rebound number (SRn) for surface hardness evaluations; and point load index test (Is(50)) , especially useful in core rock sample testing.Each of these variables has been widely recognized in the study as a significant contributor to the mechanical properties of rocks.
• BD: represents the mass per unit volume of the rock, offering insights into its overall density and compactness.• BTS: reflects the rock's ability to withstand tensile stresses, providing crucial information on its structural integrity.
• DD test: measures the density of the rock without considering water content, contributing to a more accurate assessment of its composition.• Vp: indicates the speed at which compressional waves travel through the rock, offering insights into its elastic properties.• SRn: provides an estimate of the rock's surface hardness, which correlates with its overall strength.• Is(50): measures the rock's strength under point loading conditions, offering valuable data on its resistance to applied forces.
In this study, 106 datasets are used from the published paper [32][33][34], of which 70% (74 samples) are related to training and 30% (32 samples) are related to the testing section.The rock specimens were also subjected to measurements of their bulk densities.The test procedure recommended by the International Society for Rock Mechanics (ISRM) was implemented.The weathering grade categorization employed adheres to the methodology proposed by the ISRM.As indicated in this table, the samples vary in weathering degree, ranging from slightly weathered to extensively weathered.The BD values of the rock samples vary between 2089 and 3534 (kg/m 3) .The rock samples in this investigation exhibit a range of indirect tensile strengths, or BTSs, from around 0.7 to4.2(MPa) .The UCS measurements, however, vary between 5.5 and61.1(MPa) .As anticipated, the UCS falls proportionally with the increase in weathering intensity.As an example, the average UCS for grade IV is10.6(MPa) , whereas for gradeII , this number rises to60(MPa) .The results for Vp demonstrate that Vp values are elevated for shales that are denser and have lower porosity.However, the Vp values vary between 1247(m/s) for rock samples that are extensively weathered and 2910(m/s) for barely weathered rock samples.The results indicate that the maximum compressive strength of rock samples is 4.1(MPa) for gradeII .However, for extensively weathered shale rock samples (grade IV), this value reduces to0.1(MPa) .Moreover, 70% of the dataset belonged to the train- ing set and 30% to the test set.To explore the influence of these input variables on UCS outcomes, experimental records are provided in Table 2.In addition, the dataset is mentioned in Appendix 1.
Scatter plots in Fig. 1 visually represent data points on a Cartesian plane, where the horizontal axes represent the input variables, and the vertical axes correspond to the output variable (UCS).The distribution of data points, their concentration, and any discernible patterns or trends within the plots can offer valuable insights into the relationship between these variables.Evidently, among the seven variables under consideration, there is a uniform dispersion of data points for three variables: sample number, Vp, and Is(50).In contrast, the remaining four variables exhibit a notable concentration of approximately half of the data points at zero for each variable.Figure 2 indicates that the correlation matrix provides insights into the linear relationships between different variables in the dataset.Notably, strong positive correlations, such as the 0.9250 correlation coefficient between BD and BTS, indicate that as one variable increases, the other tends to increase as well.Conversely, strong negative correlations, like the − 0.9792 correlation between BD and DD, suggest that as one variable increases, the other tends to decrease.The matrix also reveals interesting patterns, such as the strong negative correlation (− 0.9669) between SRn and BD, indicating an inverse relationship between these two variables.Similarly, the strong Fig. 1 The scatter plot between input and output negative correlation (0.9830) between SRn and DD suggests a robust inverse connection.These findings can be valuable for understanding the interplay between geological or engineering parameters represented by the variables.Additionally, moderate negative correlations, like the − 0.6226 correlation coefficient between UCS and BD, provide further insights into the relationships within the dataset.

K-nearest neighbor (KNN)
The KNN technique is known for its simplicity, effectiveness, and ease of implementa- tion [35].Like artificial neural networks (ANN) and random forests (RF) , KNN can be applied for classification and regression tasks.Several advantages are associated with the utilization of this method: 1.It is straightforward and easily understandable, making it accessible for practical implementation.

When applied to regression and classification, it can train non-linear decision
boundaries and offers flexibility in defining them by adjusting the K value.These fea- tures enhance its versatility.3. Unlike some other architectures, KNN does not involve a specific training step.4. The method involves only one hyperparameter, denoted as K , simplifying the adjust- ment of other hyperparameters.
The fundamental principle underlying KNN is identifying a set of K samples, often determined using distance functions, that exhibit proximity to unknown samples within the calibration data.It is achieved by identifying sample groups that share similarities.Subsequently, KNN ascertains the category of unfamiliar samples by computing the mean of response variables and then contrasting these outcomes with those of the K -selected samples [36].Consequently, the choice of the value for K plays a pivotal role in the effectiveness of the KNN algorithm [37].KNN operates on the fundamental principle of proximity, predicting a target variable by considering the majority class or average value of its k-nearest neighbors in a multi-dimensional feature space.In the context of this study, KNN leverages the similarity between rock samples in this feature space to estimate their UCS.
The methodology of KNN involves several key steps.Firstly, distance calculation is performed, computing the distance between the target rock sample and all other samples in the dataset using a specified distance metric, such as the commonly used Euclidean distance.Subsequently, neighbor selection identifies the k-nearest neighbors of the target sample based on the calculated distances.For classification tasks, the algorithm employs majority voting among the neighbors to assign the class to the target sample.In regression tasks, it calculates the weighted average of the target variable based on the distances to these neighbors.
Two crucial considerations in the KNN methodology are hyperparameter selection and feature scaling.The choice of the hyperparameter "k, " representing the number of neighbors, significantly influences the model's performance.A smaller "k" provides a more flexible model, whereas a larger "k" results in a smoother decision boundary.Additionally, proper scaling of features is essential as KNN is sensitive to the magnitude of input variables.
In the context of this study, KNN is specifically applied to predict the UCS of rocks.The algorithm utilizes a carefully selected subset of variables for this purpose.Its suitability for the complex task of modeling UCS in highly fractured, porous, and weak rock formations is attributed to its simplicity, interpretability, and ability to capture non-linear relationships.This comprehensive introduction to KNN sets the stage for its role in predicting UCS in rocks, emphasizing its operational principles, methodology, and key considerations in the study's context.
In the context of regression tasks, 3 distance functions, which assess the distances among neighboring points and are represented by Eqs.(1) to (3), are employed for this purpose: where F (e) represents the Euclidean distance function, F (ma) corresponds to the Man- hattan distance function, and F (mi) represents the Minkowski distance function.Here, x i and y i refer to the ith dimension of the data points x and y , and q represents the order parameter governing the distance calculation between these points. (1)

Alibaba and the Forty Thieves (AFT)
The framework of AFT encompasses three discernible states, each of which can be analyzed and delineated as follows [38,39]: First state The modeling of the pursuit of Ali Baba by the thieves, utilizing data acquired from an information source, can be effectively illustrated by employing Eq. ( 4).This equation serves as a means to represent the positions held by the individual thieves during the pursuit.
Where x t+1 i indicates the location of the ith theft during the subsequent time step (t + 1) .m t a(i) shows the degree of cunning Marjaneh employed to trick the burglar i , at time t .best t i symbolizes the optimal location attained by thief I till the current time step (t) .gbest t is the greatest worldwide rank attained by a thief as of the current t .r 1 , r 2 , rand , p , and q are values that are created at random and fall between [0,1] p ≥ 0.5 indi- cates either a value of 0 or 1. y t i shows Ali Baba's location with respect to thief i at time t .The definition of a is given by using Eq. ( 7).One of two values may be assigned to sgn(rand − 0.5) : −1or1 .Td t stands for the thieves' tracking distance, as determined by Eq. ( 4).P p t reflects the thieves' possible capacity for perceptual detection of Ali Baba, as determined by Eq. ( 6).
where τ 0 (τ 0 = 1) serves as a preliminary tracking distance estimate.τ 1 (τ 1 = 2) is used to control how much exploration and exploitation are combined.t and T refer to the maxi- mum and current iteration values, respectively.0 ( 0 = 1) signifies the ultimate estima- tion of the likelihood that the thieves will successfully achieve their objective after the search. 1 ( 1 = 1) represents a constant used to regulate the balance between explora- tion and exploitation.rand(n, 1) is produced by generating a series of random numbers between 0 and 1.
Here, f (0) indicates the fitness function's value or score.Second state: The thieves have the potential to realize that they have been misled, which could prompt them to venture into previously unexplored and unforeseen areas. (4) x t+1 i = Td t u j − l j r + l j ; p ≥ 0.5, q ≤ P p t In this case, the bounds of the dimension j search space are denoted by u j (the upper bound) and l j (the lower bound).A random variable in the interval [0, 1] is called r.
Third state: To enhance both the exploration and exploitation aspects of the AFT algorithm, the thieves may extend their exploration to additional search positions beyond those determined by Eq. ( 4).This scenario can be formally represented by Eq. ( 10): The basic AFT algorithm's iterative pseudo-code steps can be precisely presented as follows:

Improved Manta-Ray Foraging Optimization (IMRFO)
In the original Manta Ray Foraging Optimizer (MRFO) [40], the exploitation phase involves individuals updating their positions based on the best fitness individual.This can lead to reduced stagnation in local optima and population diversity.Additionally, MRFO exhibits weak solution stability due to its limited fine-tuning capacity.An improved version called IMRFO is introduced to address these limitations.IMRFO introduces a con- trolling factor of exploring to enhance search, employs a coefficient of adaptive weight with Levy flight to maximize diversity and maintain population balance, and incorporates Morlet wavelet mutation with the fine-tuning capability to prevent premature convergence to local optima and ensure solution stability.
Factor of exploring control (10) In MRFO, exploration is limited due to a low exploration probability, especially in the first half of the optimization process, governed by the value of t/T .In contrast, the IMRFO algorithm employs a factor of exploring control ( p s ), to enhance exploration.This factor increases the likelihood of exploration in the latter optimization stages, offering improved search capabilities.
where r represents a random number within the interval [0, 1] .When the value of p s exceeds 0.5, the IMRFO algorithm engages in exploration; conversely, it prioritizes exploitation when p s falls below 0.5.The factor of exploring control exhibits a reducing trend coupled with random oscillations, compelling the algorithm to emphasize exploration during later iterations [41].
By defining θ as θ = 1 − t T , the expression for p s (t) becomes p s (t) = 5 r .θ .To deter- mine the probability of p s being greater than 0.5, it can be calculated as follows: Consequently, the exploration probability within the IMRFO amounts to 0.8509 × 0.5 , yielding a value of 0.4254 over the optimization process.

Coefficient of adaptive weight with Levy flight
Inspired initially by natural foraging behaviors, Levy flight has become a valuable tool for efficient exploration in unknown spaces, widely used in various metaheuristic algorithms.It enhances search behavior by incorporating Levy flight's characteristic of short and occasional long steps into the MRFO's cyclone foraging strategy.This adaptation fosters diversity among exploration single and guards against premature convergence to local optima.
The length of the random step in the Levy flight is determined via the Levy distribu- tion, which is expressed as follows [42]: Here, represents the tail index or stability, while s denotes the length of the step.Fol- lowing the algorithm of Mantegna, the length of step for the Levy flight is defined in the following: The variables u and v follow normal distributions, and specifically: (11) Ŵ is employed in the computation, with a default value assigned to parameter β set at 1.5.Thus, the formulation of a coefficient of adaptive weight, integrating the Levy flight into the cyclone foraging techniques, is as follows: Observing Eq. ( 14) can discern two critical effects.Firstly, the frequent generation of multiple short steps by the Levy flight enhances the exploitation capacity of the algorithm.In contrast, occasional long steps bolster exploration, effectively ensuring local optima avoidance.Secondly, the function e 2(T −t+1)/T exhibits a reducing trend by iterations, thus offering a larger exploration scope during early iterations and gradually narrowing it in later iterations.This characteristic enhances the algorithm's search efficiency and ensures that step lengths remain within the variable boundaries.
The cyclone foraging strategy employed in the IMRFO algorithm is defined as follows:

Wavelet mutation strategy
The MRFO algorithm may encounter challenges in getting stuck in local optima, leading to an inefficient exploration of the instability of solutions and the global optimum.IMRFO incorporates Morlet wavelet mutation to enhance the algorithm's ability to break free from stagnation, improve convergence rates, and ensure solution stability.This wavelet mutation involves dynamically adjusting the mutation process by integrating wavelet function translations and dilations [42,43].In pursuit of fine-tuning objectives, control over the wavelet function's dilation parameters is exercised to reduce its amplitude, consequently constraining the mutation space as iterations progress.
Given that p m represents the mutation probability and r 4 presented a random number within the [0, 1] range, the integration of wavelet mutation enhances the somersault foraging techniques as follows: (15) where p m represents the mutation probability, set to a value of 0.1, and σ w denotes the wavelet function's dilation parameters, which can be defined in the following: where ψ(x) corresponds to the wavelet function of Morlet, determined in the following: Over 90% of the overall energy of the wavelet function is concentrated within the range of [−2.5, 2.5] .Consequently, σ w can be stochastically generated from the interval [−2.5a, 2.5a] , with "a" representing the dilation parameter.This parameter scales pro- gressively from 1 to "s" as the iterations' number grows.To prevent overlooking the global optimum, a monotonically growing function is defined in the following: Here, g is a fixed constant, with a value set to 100,000.The fundamental steps of the IMRFO algorithm can be accurately represented through the following iterative pseudo-code [41]: (20) x

Results assessment criteria
In this study, the effectiveness of prediction algorithms was rigorously evaluated using a comprehensive set of nine key metrics.These metrics served as performance indicators and included: where T i and P i are actual and predicted values, respectively.T is the average of all the tested results, while n represents the number of samples in the analyzed dataset.P shows the mean of predicted value.n test and n train indicate the sample number of test and train, respectively. (24)

Hybridization
The hybridization procedure integrates the KNN model with two distinct metaheuristic optimization algorithms: IMRFO for KNIM and AFT for KNAF.The detailed discussion of the hybridization process unfolds as follows: ➢ KNIM (KNN optimized with IMRFO): • Initialization: The process begins by initializing the KNN model with a predefined set of hyperparameters, representing the starting configuration before optimization.• Optimization with IMRFO: IMRFO is applied to the initialized KNN model, orchestrating an iterative optimization process.This involves refining the hyperparameters to augment the model's performance over successive iterations.• Final KNIM model: The outcome of the IMRFO optimization process yields the optimized KNN model, denoted as KNIM.This refined version incorporates improved parameter configurations, enhancing its predictive capabilities for UCS prediction in rocks.
➢ KNAF (KNN optimized with AFT): • Initialization: KNAF commences with the initialization of the KNN model, initially set with default hyperparameters, providing a baseline for subsequent optimization.• Optimization with AFT: The AFT algorithm is employed to optimize the hyperparameters of the KNN model.AFT, with its exploratory nature, iteratively explores the solution space to pinpoint optimal hyperparameter configurations.• Final KNAF model: The conclusion of the AFT optimization process results in the finalized KNN model, identified as KNAF.This optimized version reflects superior hyperparameter settings, enhancing the KNN model's effectiveness in predicting UCS in challenging geological conditions.

Metaheuristic optimization hyperparameters
➢ IMRFO: • Parameters: IMRFO involves configuring parameters such as population size, maximum iterations, and the exploration-exploitation trade-off.The specific values are contingent upon the study's implementation details. ➢ AFT: • Parameters: AFT encompasses parameters like population size, maximum iterations, and potential exploration-exploitation parameters.The actual values utilized in the study are explicitly defined during the AFT optimization process.This meticulous consideration of metaheuristic optimization algorithms and their associated hyperparameters ensures a systematic and effective approach to enhancing the KNN models (KNIM and KNAF) for precise UCS prediction in the domain of rock mechanics.The hyperparameters for the KNN models, including the default and optimized versions, are reported in Table 3.
These hyperparameters represent the key configurations of the KNN models within the study, both before and after optimization using IMRFO and AFT.

Convergence
In the study, convergence is assessed based on the RMSE, a key metric for evaluating the accuracy of regression models.The metaheuristic optimization algorithms, IMRFO and AFT, iteratively refine the hyperparameters of the KNN model.Convergence is observed through the RMSE, which ideally decreases over iterations, signifying improved alignment between predicted and actual UCS values.The process stabilizes when further iterations cease to enhance model performance significantly.The final RMSE at convergence serves as a crucial indicator of optimized model accuracy in predicting UCS in rocks, aligning with the study's goal of improving predictive capabilities.Figure 3 shows the convergence of developed hybrid models.

System configuration
The system configuration for model development involved a hardware setup with an Intel Core i7-3770K CPU running at 3.50 GHz, complemented by 16.0 GB of RAM and a 1-terabyte hard drive.The operating system used was Windows 11 Pro, designed for a 64-bit architecture.An NVIDIA GeForce GT 640 GPU facilitated graphics processing.In terms of software, Python served as the primary programming language for conducting experiments and developing models.The scikit-learn machine learning framework played a central role in implementing various machine learning algorithms and models.Additionally, for data analysis and visualization tasks, the study leveraged popular Python libraries, including Pandas, NumPy, and Matplotlib.

Results and discussion
In the current study, the research aims to select the optimal UCS estimation model by examining the performance of KNN-based models.These models, including single KNN and hybrid models optimized with AFT and IMRFO, are organized into training, validation, and testing sets.The evaluation employs nine metrics to assess their performance, with results presented in Table 5 and visualized in various graphs to facilitate comparative analysis and model selection.Table 5 provides a comprehensive overview of the performance metrics, including R 2 , RMSE, MSE, FB, SI, NSE, n20-index, OBJ, and RSR, for all prediction models within the training, validation, and testing sets.A detailed examination of the model's predictive capabilities in estimating the UCS of rock samples is presented in the subsequent analysis: • The KNIM hybrid model demonstrated remarkable performance with maximum R 2 values of 0.995 during the training phase and 0.986 each for both the validation and testing phases.These high R 2 values signify that this model effectively explains a substantial portion of the variance in the UCS through the incorporated input variables.
In essence, this shows that the model and the data fit together well, highlighting the validity of the selected input variables as reliable indicators of the anticipated result.• Regarding error values, the KNIM model is the most accurate among the developed models, exhibiting approximately twofold and threefold lower RMSE values than the KNAF and KNN models.This suggests that KNIM provides superior predictive accuracy and is associated with significantly more minor discrepancies between predicted and actual values than the other models, emphasizing its effectiveness in UCS estimation.• A minimum RSR value of 0.021, observed in the KNIM model, indicates an excellent fit where the model's predictions closely match actual data.This suggests that the model effectively captures the variability in UCS while keeping standardized residuals relatively small, signifying its accuracy and reliability.• The minimum FB value of 0.0005 (MPa) observed in the KNIM model during the training phase indicates minimal bias in its predictions.This suggests that the model offers highly accurate and unbiased estimates, aligning closely with the data.• The KNIM model's ability to consistently achieve the highest NSE and n20-index values further reinforces its superior performance in capturing the underlying patterns and variability in the data.• The lower OBJ and SI values for KNIM reinforce its superior overall performance and robustness in handling extreme values compared to the other KNN-based models (KNN and KNAF).
In the assessment of the models, it is evident that overfitting did not occur.Overfitting manifests when there is a substantial disparity between the training and test outputs, a phenomenon conspicuously absent in the outcomes of these models.
Figure 4 provides graphical representations illustrating the relationships between experimentally determined UCS values and their corresponding predictions.This study employs advanced quantitative data analysis techniques, focusing on two key evaluation metrics: RMSE and R 2 .RMSE helps govern data dispersion, with reduced values indicating denser and more concentrated findings.The R 2 evaluation brings data points closer to the central axis, enhancing alignment.The diagram features critical elements such as the central line at Y = X, a linear regression model, and four boundary lines at Y = 0.9X and Y = 1.1X, denoting 10% underestimation and overestimation, respectively.The KNIM model exhibits an optimal concentration of predicted UCS values around the central line, outperforming the single KNN model and another hybrid model (KNAF), which show scattered data dispersion beyond an acceptable range.
Figure 5 highlights the excellent alignment between observed and predicted UCS values across all three models, with the KNIM model excelling.In this figure, the dashed line shown in the figure connects the prediction points to each other.At the same time, the maximum prediction-measurement difference is attributed to the KNAF model.All three models experienced maximum variation between measured and estimated values in their testing phase.
Figures 6 and 7 demonstrate the error percentage in histogram density and half-box plots.According to Fig. 5, for KNIM and KNAF, the percentage of errors near zero percent is almost twice the KNN model, indicating that optimizing the KNN model with two selected optimizers decreased error values.When comparing the range of error values of the models provided in Fig. 6, it can be observed that KNN in the training phase and KNN in the validation phase have the most and most minor broad range of error values.The KNIM hybrid model performs better in all three phases, while KNAF with marginal variation ranks second.
Furthermore, the best model (KNIM) and measured values are mentioned in Appendix 2.

Main limitations
Despite the promising outcomes of this study, certain limitations need consideration.Firstly, the predictive models developed, while effective in the context of UCS prediction for specific rock types, may exhibit variability in performance across diverse geological formations.The models' reliance on selected variables might limit their generalizability to rock types not represented in the current dataset.Additionally, the reliance on laboratory test data for model training raises questions about the applicability of the models to real-world field conditions.

Wider applicability of methods
The methods employed in this study, particularly the use of K-nearest neighbors (KNN) and optimization algorithms (Alibaba and the Forty Thieves, Improved Manta-Ray Foraging Optimizer), offer a robust framework for UCS prediction.However, the wider applicability of these methods extends beyond rock mechanics.Similar methodologies could find utility in diverse fields such as geotechnical engineering, materials science, and environmental studies, where predicting material strength properties is paramount.The simplicity and interpretability of KNN, coupled with the optimization algorithms, contribute to the versatility of the proposed approach.

Findings and implications
The findings indicate that the optimized KNN model, particularly KNIM, outperforms the baseline KNN and KNAF models in terms of accuracy and predictive capabilities for UCS prediction in certain rock types.The marginal differences observed in the Wilcoxon test between KNAF and KNIM warrant attention, signaling potential avenues for model refinement.The efficient run time of KNN makes it a favorable choice for realtime applications, while the optimization algorithms enhance its performance.

Comparison
Table 6 provides a comprehensive comparison between the presented study and previously published articles in terms of the model used, evaluation metrics (R 2 and RMSE), and their respective performance.The inclusion of diverse models and evaluators highlights the broader context of UCS prediction methodologies in the literature.The present study, utilizing the KNIM model, demonstrates competitive results with a high R 2 of 0.991 and an RMSE of 2.688.

Wilcoxon test
The Wilcoxon test was employed to assess the comparative performance of three models: KNN, KNIM, and KNAF.The test results, considering p values and statistics for each pair of models, provide insights into their statistical significance.Table 7 shows the result of the Wilcoxon test.
The Wilcoxon test results reveal that there is no statistically significant difference in performance between KNN and KNIM (p value = 0.9585, statistic = 2819) as well as between KNN and KNAF (p value = 0.7135, statistic = 2719).These findings suggest comparable performance between these model pairs.However, the comparison between KNAF and KNIM indicates a marginally significant difference (p value = 0.0902, statistic = 2298).While not reaching conventional levels of significance, this result suggests a potential difference that may warrant further investigation or consideration.In summary, the Wilcoxon test suggests comparable performance between KNN and KNIM and between KNN and KNAF.The KNAF and KNIM pair shows a marginally significant difference, indicating the need for cautious interpretation and potential further exploration.

SHAP value
The analysis utilizing SHAP (SHapley Additive exPlanations) values offers a comprehensive understanding of how various variables influence the model's output.Illustrated in Fig. 8, the SHAP values elucidate the nuanced impact of inputs on the model's predictions.The findings underscore the significant influence of Vp, DD, and Is on the model's UCS predictions, aligning closely with geological principles.Conversely, BD exhibits a comparatively lesser impact on UCS.Such insights not only enhance the interpretability of the model but also furnish invaluable guidance for researchers and practitioners in the field, facilitating informed decision-making and furthering understanding of geological processes.

Conclusions
In summary, this research used hybrid machine learning models to predict unconfined compressive strength (UCS) in rock samples.The study addresses the challenges of sample preparation by developing and evaluating these hybrid models, which incorporate the K-nearest neighbor (KNN) model optimized with Alibaba and the Forty Thieves (AFT), as well as Improved Manta-Ray Foraging Optimizer (IMRFO).Based on the assessment findings, the KNIM model emerges as the most optimal choice, boasting the following advantages: • Improvements over KNN single model: KNIM demonstrates substantial enhancements over the KNN single model, featuring a 2% higher R 2 value, a notable 43.7% reduction in RMSE, and a substantial 68.4% decrease in MSE values.These results underscore KNIM's superior predictive accuracy and ability to reduce prediction errors significantly.These findings collectively establish KNIM as a highly effective and promising model for UCS prediction in rock samples, offering valuable insights for applications in civil engineering.The study's findings apply primarily to the specific dataset and context of predicting UCS in rocks.The transferability of the proposed optimization algorithms, AFT and IMRFO, requires validation across diverse datasets and applications.The study's relevance to different rock types and engineering scenarios needs careful consideration.Limitations include the reliance on a specific dataset, the sensitivity of optimization algorithms to conditions and hyperparameters, assumptions of data stationarity, and the exclusion of potentially relevant variables.Robustness testing, external validation, and consideration of real-world variability are suggested for future research to address these limitations.The study's findings suggest several potential directions for future research to enhance predictive models for UCS.The recommendations include exploring additional variables (geological, geophysical, or mineralogical), conducting temporal variability analysis, assessing regional specificity, exploring ensemble models, incorporating advanced machine learning techniques, validating models on diverse datasets, performing real-world testing and field validation, exploring alternative optimization algorithms, and integrating remote sensing data.These avenues aim to advance the accuracy and reliability of predictive models for UCS in rocks beyond the current study.

Fig. 2
Fig. 2 Correlation between the input and output variables

Fig. 7
Fig. 7 The half box of errors among the developed models

Fig. 8
Fig. 8 Impact of inputs on model's output

Table 1
Summary of published articles

Table 2
Statistical properties of input and UCS

Table 3
Hyperparameters of developed models Fig. 3 Convergence of developed hybrid models

Table 4
displays the run time of the developed models, showcasing the computational efficiency of each model.The results indicate that KNN has the shortest run time at 0.1629 s, followed by KNIM with a run time of 148.73 s, and KNAF with the longest run time at 354.57s.

Table 4
Run time of developed models

Table 5
The result of developed KNN-based models

Table 6
Comparison between the presented and published articles

Table 7
Result of Wilcoxon test • Enhancements over KNAF hybrid model: Compared to another hybrid model, KNAF, KNIM exhibits noteworthy enhancements, including a 1.1% higher R 2 value, indicative of a better data fit.Additionally, KNIM achieves a considerable 37.8% reduction in RMSE and a substantial 61.4% decrease in MSE values, underscoring its superiority in predictive accuracy and error reduction.