1 Introduction

Unconfined compressive strength (UCS) is an essential mechanical rock-parameter for building geomechanical models. It defines the maximum compressive stress limit that the rock can endure without failure when uniaxial loading is applied under confinement conditions [1]. Rock mechanics is generally theoretical and applied science that describes the mechanical behavior of the rock when different stresses are applied. Rock failure is one of the petroleum-related features of rock mechanics which is the reason behind many downhole problems such as solids production and wellbore instability issues [2]. The availability of UCS data of the downhole formations has a high degree of importance in optimizing the drilling operation performance, bit hydraulics, determining the proper mud weight while drilling, and avoiding wellbore instability issues [3].

Rock mechanical properties can be determined directly using experimental tests conducted on retrieved core samples representing the actual stress-state conditions and mechanical properties of the rocks downhole. UCS can be estimated in the laboratory using different tests such as uniaxial compressive strength test, triaxial compressive strength test, scratch test, Schmidt hammer test, and point load test. These laboratory measurements are considered the most accurate and reliable method for determining such properties [4]. However, since retrieving core samples representing the sections of interest is very costly and requires a lot of time, core-testing data cannot yield a continuous profile of UCS along the drilled wellbore [5]. Besides, representative core samples are not always available and their number is often restricted. Therefore, indirect methods were developed to fill the missing gaps using derived correlations between the rock mechanical properties and petrophysical well-log data.

Many studies in the literature have reported different correlations (Table 1) to predict UCS of different lithologies using logging data based on nonlinear regression techniques [6,7,8,9,10,11]. Most of these models are based on sonic transit time (Δt) and formation porosity (Ø) for estimating UCS. Moreover, the application of artificial intelligence tools has been introduced to correlate core-testing UCS data with different well-log data such as bulk density and sonic log data [12,13,14]. However, such well-log data are not always available while drilling the wellbore, as they are often obtained using a wireline logging technique which is usually performed after drilling the wellbore to avoid the harsh drilling environment [15]. Besides, the acquisition of logging data while drilling is a costly process and has several operational limitations and requires many corrections as well. This created the main motivation behind this study which is developing a new technique through which UCS values can be estimated in real-time other than using the well-log data. Additionally, the substantial value of obtaining the UCS data during drilling addresses the increasing need for such data in real-time. This is because it is very crucial to optimize the drilling operation, reduce the non-productive time (NPT), prevent the collapse of downhole formations, and, hence, avoid many wellbore instability problems by choosing the proper mud weight.

Table 1 Published correlations to predict UCS in MPa

Therefore, the main objective of this paper is to introduce a novel technique for predicting the UCS values of the downhole formations while drilling. This involved developing new models using different AI tools to predict UCS depending on the mechanical drilling parameters instead of well log data. These mechanical drilling parameters are usually available while drilling; include rate of penetration (ROP), mud pumping rate (GPM), stand-pipe pressure (SPP), drillstring rotating-speed (RPM), drilling torque (T), and weight on bit (WOB). Unlike the logging data, such drilling data are always available during the drilling operation at a low cost. Accordingly, the developed AI-based models would help estimate UCS of the downhole formations while drilling in a time- and cost-effective way.

2 Materials and methods

In this study, new AI models were developed to estimate UCS values of the downhole formations while drilling using three AI tools: the artificial neural network (ANN), adaptive neuro-fuzzy inference system (ANFIS), and support vector machine (SVM). The developed models used the mechanical drilling parameters as feeding inputs to predict the output; formations’ UCS-values.

2.1 Data description

A dataset of 1771 data points was collected representing a vertical section (Well A) within a field in the Eastern province of Saudi Arabia (Middle East Region). The obtained dataset included mechanical drilling data and the corresponding UCS values of the drilled formations. These drilling parameters (ROP, GPM, SPP, RPM, T, and WOB) are normally recorded at the surface while drilling using accurate real-time sensors to monitor the drilling performance. The corresponding UCS data were extracted from the geomechanical model of the area under study: The aforementioned model was developed based on actual core samples lab-testing data.

2.2 Dataset statistical analysis

The dataset used was statistically analyzed to describe its ranges and distributions before the model development. Table 2 lists different statistical parameters for the inputs (ROP, GPM, SPP, RPM, T, and WOB) and the output parameter (UCS). The ranges of the input and output parameters are ROP from 35.18 to 108.34 ft/hr, GPM from 645.30 to 854.01 gallon-per-minute, SPP from 2140 to 3076 psi, RPM from 77.94 to 162.53 revolution-per-minute, T from 4.29 to 10.68 kft.Ib, WOB from 1.54 to 25.48 kIb, and UCS from 1030.02 to 17378.06 psi. The dataset used was found to cover wide ranges with satisfactory distribution as inferred from the statistical analysis. This would boost the prediction performance of the proposed model to describe the phenomena more efficiently.

Table 2 Statistical analysis describing the ranges and distribution of the used data

2.3 Data processing and filtration

The prediction accuracy of the AI-based models is significantly affected by the quality of the data used while developing the model. Therefore, the data were pre-processed and filtered using statistical analysis and engineering sense based on the literature. A specially designed MATLAB program was used to remove unreasonable values like zeros and negative values in addition to any missing points. Then, outliers were removed using box and whisker plot, in which the top whisker represents the upper limit of the data and the bottom whisker represents the lower limit of the data [16]. Any value beyond these limits was considered an outlier then removed. These limits were determined using the statistical parameters listed in Table 2.

2.4 Study of input(s)/output relationship strength

To identify the strength of the relationship between the output (UCS) and the input parameters, the Pearson correlation coefficient (R) with a mathematical formula expressed in Eq. 8 was used to identify how strongly two parameters are linearly related to each other [17]. Its value ranges from − 1 to +1. A strong direct linear-relation is indicated with an R-value of +1. On the contrary, the R-value of − 1 shows a strong inverse linear-relation between these two variables. While the R-value of zero indicates no linear relationship exists between the two study variables. Figure 1 shows the relative importance between the output parameter (UCS) and the input parameters individually in terms of R-value. UCS had R-values of 0.15, 0.14, 0.12, 0.07, 0.02 and -0.18 with ROP, SPP, T, WOB, GPM, and RPM, respectively.

$$ R = \frac{{k\sum {xy - \left( {\sum x } \right)} \left( {\sum y } \right)}}{{\sqrt {k\left( {\sum {x^{2} } } \right) - \left( {\sum y } \right)^{2} } \sqrt {k\left( {\sum {b^{2} } } \right) - \left( {\sum b } \right)^{2} } }} $$
(8)

where; R represents the correlation coefficient between the two variables x and y.

Fig. 1
figure 1

Relationship strength between the output (UCS) and the input parameters in terms of correlation coefficient (R)

2.5 Application of artificial intelligence tools

2.5.1 Artificial neural network (ANN)

ANN is an artificial intelligence tool which has recently got a remarkable reputation for modeling complex engineering phenomenon and complicated problems in a significant efficient way. Recently, ANN has been used in many applications in petroleum engineering fields. Many studies in the literature introduced the application of ANN in the area of formation evaluation and rock characterization [18,19,20,21,22,23,24]. A typical neural network consists of three types of layers; input layer, hidden layer, and output layer [25]. These layers are connected by a set of weights and biases which are tuned during the optimization process of the network to control the prediction performance of the network [26]. The connection between the network components mimics that of the biological neural system in handling and processing the data [27]. The network is usually trained with different learning algorithms to optimize the network and to control the processing of the neurons [28]. These neurons are considered the elementary elements from which any neural network is constructed [29].

2.5.1.1 Neural network application to predict UCS

In this study, a new model was developed using the obtained dataset to predict UCS while drilling using ANN. A specially designed MATLAB program was used to feed the network with the input parameters to estimate UCS. Figure 2 shows a schematic diagram for the developed network architecture. The model development passes through three main stages; these are the training process, the testing process, and the validation process. First, the obtained dataset was randomly stratified into two sets; training and testing set for building the model. Splitting the data was in the way that the testing set was within the same range as the training set. During the training process, the network was trained with the data to tune its parameters to achieve the highest possible accuracy. Then, the results were evaluated and compared to the actual output (UCS) values based on two main evaluating factors; these were correlation coefficient (R), and average absolute percentage error (AAPE). The formulas used for estimating these factors (R and AAPE) are stated in Eqs. 8 and 9. Thereafter, the developed network was tested and cross-validated using hidden testing set to check the performance of the developed network while using unseen data.

$$ {\text{AAPE}} = \frac{{\sum {\left| {\frac{{{\text{UCS}}_{\text{measured}} - {\text{UCS}}_{\text{predicted}} }}{{{\text{UCS}}_{\text{measured}} }}} \right| \times 100} }}{n} $$
(9)

where; n is the number of the data points used.

Fig. 2
figure 2

The typical schematic architecture of the developed network

2.5.1.2 ANN-model optimization

The accuracy of the prediction process depends mainly on the tuning process of the network parameters. These parameters include:

  • Data splitting ratio

  • Number of hidden layers

  • Number of neurons in each hidden layer

  • Network function

  • Type of transfer functions

  • Type of training algorithm

  • Learning rate

The developed network was trained using the stochastic gradient descent optimization algorithm which is considered the most popular optimization algorithm in AI applications. It depends on updating the network parameters iteratively in the gradient direction of the objective function. Through every update, the algorithm helps the model gradually converge to reach the optimal value of the objective function. It involves taking random values of the model hyperparameters and adjusting them iteratively based on the available options to reduce the loss function eventually. Through each iteration, the model is guided to update the model hyperparameters to reduce the error of the next iteration using the backpropagation technique.

The developed MATLAB code was designed to generate different combinations of the aforementioned parameters with their available options listed in Table 3. The network was run with several trials and each trial included using one of the generated combinations of ANN parameters. During each trial, the results were tested, and the prediction performance was evaluated based on the comparison between the actual UCS values and the predicted ones, indicated from the evaluating factors (R, and AAPE). The target of the optimization process was to identify the ANN parameters’ combination which would result in the highest prediction accuracy. This would be inferred from the highest R-value between the predicated and actual UCS values accompanied by the lowest AAPE between them. The optimized network parameters were:

Table 3 Summary of the tested ranges of the network parameters during the optimization process
  • Data splitting ratio: 70/30 ratio for training and testing respectively

  • Number of hidden layers: single hidden layer

  • Number of neurons in each hidden layer: 30 neurons

  • Network function: fitnet

  • Type of transfer functions: tan-sigmoidal function (tansig)

  • Type of training algorithm: Bayesian Regularization backpropagation (trainbr)

  • Learning rate: 0.12

The proposed model was developed by training the network with 70% of the dataset (1240 points) while 30% of the data (531 points) was used for testing the performance of the model. The results of the prediction process showed that the predicted UCS values significantly matched with the actual values. This obvious match is indicated from the high R-value which reached 0.99 between the predicted and actual UCS values for both the training and testing processes as shown in the cross-plots (Fig. 3a and b). These cross-plots inferred that the predicted UCS is so close to the actual ones as the plotted data considerably coincide with the forty-five-line with a correlation novalety coefficient exceeded 0.99 between the actual and predicted UCS values. This confirms the high accuracy of the prediction of The UCS values using the developed ANN-model.

Fig. 3
figure 3

Crossplots between the predicted and actual UCS values for a training process, and b testing process, using the developed ANN-model. This shows how the predicted values were so close to the actual ones

2.5.2 Adaptive neuro-fuzzy inference system (ANFIS)

Fuzzy Logic (FL) systems are structured based on fuzzy techniques that resemble human reasoning during information processing. Its technique emulates the way of human decision making involving all intermediate possibilities. Adaptive fuzzy systems depend on the automatic online synthesis and tuning of fuzzy controller parameters using online data to continually “learn” the fuzzy controller. Recently, different adaptive fuzzy systems are used to simulate complex, and nonlinear systems; adaptive neuro-fuzzy inference system (ANFIS), Event-triggered adaptive fuzzy systems, etc. [30,31,32]. From the functionality perspective, there are almost no constraints on the node functions of the ANFIS network except piecewise differentiability. While from the structure perspective, the only limitation of network configuration is that it should be a feedforward network. According to these minimal restrictions, ANFIS applications are immediate and immense in various areas [33].

Additionally, many studies in the literature introduced ANFIS as a reliable predictive tool with several applications in the petroleum industry [34,35,36,37]. Therefore, ANFIS was selected in this study to build the predictive model of UCS. ANFIS is an integrated supervised learning algorithm for processing data that combines the concepts of neural networks and fuzzy logic utilizing a fuzzy inference system [38, 39]. Such a combination between neural networks and fuzzy logic provides an advantage of easy translation of the final system into a set of if–then rules, and the fuzzy system can be viewed as a neural network structure with knowledge distributed throughout connection strengths. It follows Takagi–Sugeno inference system which employs conventional Boolean logic (i.e., zeros and ones) while analyzing the systems using a set of fuzzy IF–THEN rules [33].

ANFIS uses a hybrid learning algorithm to identify parameters of Sugeno-type fuzzy inference systems. This learning algorithm uses the least-squares method and the backpropagation gradient descent method for training membership function parameters of the Fuzzy Inference System (FIS) to imitate a certain training dataset. The learning algorithm works in two main steps. First, in the forward phase, consequent parameters identify the least-squares estimate. In the backward phase, the error signals represented by the derivatives of the squared error concerning each node output, propagate in the backward direction into the input layer. During the second step, the parameters are updated by the gradient descent algorithm. A combination of the gradient descent algorithm and a least-squares algorithm is used as an effective tool for investigating the optimal parameters with much faster convergence. This is because it helps reduce the search space dimensions used by the backpropagation method [40].

2.5.2.1 ANFIS application to predict UCS

The same filtered dataset was used to build the ANFIS-model. Data were split randomly using MATLAB for selecting the best partitioning ratio that resulted in the highest prediction accuracy. Two different algorithms were tested while building the model; these are Grid partitioning; genfis-1, and subtractive clustering; genfis-2. No reasonable results were observed when genfis-1 type was applied, however, subtractive clustering type (Sugeno-Fis type) yielded much better results with accepted accuracy. The developed ANFIS-model was optimized by testing different cluster radii and evaluating the prediction accuracy in terms of R-value and AAPE as listed in Table 4. The optimized ANFIS-model of Sugeno-Fis type with a clustering radius of 0.3 and splitting ratio of 70/30 for training and testing, respectively, resulted in acceptable prediction accuracy with an R-value exceeds 0.97 between the actual and predicted UCS values compared to the other tested options. Figure 4a and b shows a high-degree matching between the predicted UCS values using the optimized ANFIS-model and the corresponding actual ones with AAPE of 7.85% for the testing process.

Table 4 Optimizing the ANFIS-model with different cluster radii
Fig. 4
figure 4

Cross-plots between the predicted and actual UCS values for a training process, and b testing process, using the developed ANFIS-model

2.5.3 Support vector machine (SVM)

SVM is one of the AI tools that can handle highly complex problems for both regression and classification purposes. It provides a larger space for training the data features in hyperplanes by transforming the data into space with a higher degree of dimensions [41]. SVM uses a statistical learning algorithm for solving quadratic-programming problems by minimizing generalization errors to reach the optimized solution [42]. SVM has been introduced as an effective predicting and classifier tool in the oil and gas industry through many studies in the literature [43,44,45].

2.5.3.1 SVM application to predict UCS

Another model was developed using the same dataset using SVM to predict UCS of the drilled formations from the drilling parameters (ROP, SPP, GPM, ROP, T, and RPM). Splitting the data into a 70/30 ratio for training and testing the model, respectively, the model was tested using two kernel functions; polynomial and Gaussian functions, with different tuning parameters; kernel option, epsilon, lambda, verbose, and C-value). Thereafter, the model performance was evaluated in terms of R-value and AAPE between the predicted and actual UCS-values. The SVM-model with the optimized parameters listed in Table 5, yielded to predicting the UCS values with an R-value of 0.94 and AAPE of 6.5% when they are compared with the actual values during the testing process. The results show that the predicted UCS values using the SVM model agreed in a satisfactory degree with the actual ones as shown in the cross-plots; Fig. 5a and b.

Table 5 Optimization of the SVM-model tuning parameters
Fig. 5
figure 5

Cross-plots between the predicted and actual UCS values for a training process, and b testing process, using the developed SVM-model

The results of the testing process of the three developed models, listed in Table 6, show that the ANN-model is more accurate with AAPE of 3% between actual and predicted UCS values, and outperforms the two other models when tested using an unseen dataset. This observation is also confirmed by the significant match between the actual and predicted UCS values from the ANN model when a continuous profile therebetween is plotted along with the section understudy for both the training and testing processes (see Fig. 6a and b). Thus, it is more recommended to use the ANN-model as a robust tool for predicting the UCS of the downhole formations from the drilling mechanical parameters while drilling.

Table 6 Comparison of the prediction performance of the three developed models
Fig. 6
figure 6

Predicted UCS versus actual UCS for a training process, and b testing process, using the developed ANN-model

3 New correlation development for estimating UCS

The ANN-model was converted from a black-box into a white-box model by extracting an empirical correlation that mimics the developed network. The derived correlation includes the weights and biases that control the connections between input/hidden layers and hidden/output layers as described in Eq. 10. Table 7 lists the weights and biases of the developed correlation.

$$ {\text{UCS}} = \left[ {\sum\limits_{i = 1}^{N} {w_{{2_{i} }} \left( {\frac{2}{{1 + e^{{ - 2\left( {w_{{1_{i,1} }} {\text{WOB}}_{n} + w_{{1_{i,2} }} T_{n} + w_{{1_{i,3} }} {\text{SPP}}_{n} + w_{{1_{i,4} }} {\text{RPM}}_{n} + w_{{1_{i,5} }} {\text{ROP}}_{n} + w_{{1_{i,6} }} {\text{GPM}}_{n} + b_{{1_{i} }} } \right)}} }} - 1} \right)} } \right] + b_{2} $$
(10)

where, UCSn is the normalized UCS value, N is the number of neurons in the hidden layer, w1 is the weights between input/hidden layers, w2 is the weights between hidden/output layers, b1 is the biases associated with the hidden layer, and b2 is the bias associated with the output layer.

Table 7 Weights and biases of the developed ANN-based correlation

To use the developed correlation, the input parameters should be normalized between − 1 and +1 as shown in Eq. 11.

$$ Y = 2 \times \left( {\frac{{X - X_{\hbox{min} } }}{{X_{\hbox{max} } - X_{\hbox{min} } }}} \right) - 1 $$
(11)

where Y is the normalized input value, X is the input parameter value, Xmin is the minimum value of the input dataset, and Xmax is the maximum value of the input.

Thereafter, the normalized value of the output (UCSn) can be calculated using Eq. 10 with the weights and biases listed in Table 7. Finally, UCSn should be de-normalized to get the UCS value using Eq. 12.

$$ {\text{UCS}} = 8174.02 \times {\text{UCS}}_{n} + 9201.04 $$
(12)

4 Model validation

4.1 Phase # 1

To evaluate the performance of the developed ANN-based correlation, it was tested using the validation dataset. This dataset included 2175 points comprising drilling parameters and the corresponding UCS values of formation interval of 2175 ft. These data were collected from another well (Well B) from the same field under study. It should be noted that the validation dataset was not used while training and testing the model. The results showed an obvious agreement between the predicted and actual UCS values indicated from the R-value which exceeded 0.98 and AAPE of 4.2%. Figure 7 shows the predicted UCS values versus the actual ones along with the depth interval. The results of the validation process demonstrated the high accuracy of the developed ANN model in estimating the UCS values of the drilled formations while drilling.

Fig. 7
figure 7

Predicted UCS versus actual UCS for the validation process using data from Well B

4.2 Phase # 2

In this phase, the developed correlation was validated by comparing its performance with previously published correlations. A dataset of 2175 points from Well B was used for testing the developed ANN-correlation against some of the previously published correlations listed in Table 1. The results confirmed the robustness of the developed ANN-based correlation for predicting the UCS values with high accuracy in terms of the lowest AAPE (4.16%) between the predicted and measured UCS values, compared to the published correlations as shown in Fig. 8. Additionally, the results of the ANN-based correlation were plotted in a cross plot versus those obtained from Eq. 1 (see Fig. 9) which resulted in the lowest AAPE (24.71%) among the other published correlations. Figure 9 shows the significant deviation of Eq. 1 results from the forty-five line which indicates that its results are far from the actual UCS values. On the other hand, the results of the developed ANN-based correlation significantly coincided with the forty-five line to confirm the high accuracy of its prediction process.

Fig. 8
figure 8

Comparison of the prediction accuracy of the developed ANN-based correlation against the preciously published correlations in terms of AAPE,  %

Fig. 9
figure 9

UCS prediction using the developed ANN-based correlation versus the published correlations

5 Conclusions

This study presents a novel technique for predicting UCS values of the downhole formations while drilling in a time-and cost-effective way. This involved developing new AI-based models to predict UCS based on the low-cost mechanical drilling parameters other than using the high-cost well-log data. Besides, the usual availability of the mechanical data during the drilling operation makes it possible to predict the UCS values on a real-time basis using the developed correlations. In this study, three different AI tools (ANN, ANFIS, and SVM) were applied to develop the proposed models using the mechanical drilling parameters (WOB, T, ROP, SPP, RPM, and GPM) as inputs for these models. The models were developed using 1771 actual data from a Middle Eastern field to be optimized. The ANN-model outperformed ANFIS- and SVM-models with a considerable match between the predicated and actual UCS values inferred from the high R-value of 0.99 and AAPE of 3.48%. An empirical correlation was then extracted to convert the model into a white-box model. The results of the validation process of the ANN-based correlation confirmed its robustness to predict the UCS values of the drilled formations while drilling with high accuracy. This was indicated from the significant match between the predicted UCS values and the actual ones with R-value exceeded 0.98 and AAPE of 4.2%.

The performance of the developed models is guaranteed whenever they are applied using a dataset within the same range of the data used for training the AI model. For other fields with different data ranges and geologic features, it is recommended to update the models with these data to update the network weights to guarantee a viable prediction process with high accuracy.