# Prediction of the Least Principal Stresses Using Drilling Data: A Machine Learning Application

Authors: Ahmed Gowida; Ahmed Farid Ibrahim; Salaheldin Elkatatny; Abdulwahab Ali
Journal: Computational Intelligence and Neuroscience
 (2021)

---

## Abstract

The least principal stresses of downhole formations include minimum horizontal stress (σmin) and maximum horizontal stress (σmax). σmin and σmax are substantial parameters that significantly affect the design and optimization of the drilling process. These stresses can be estimated using theoretical equations in addition to some field tests, i.e., leak-off test to include the effect of tectonic stress. This approach is associated with many technical and financial issues. Therefore, the objective of this study is to provide a novel machine learning-based solution to estimate these stresses while drilling. First, new models were developed using artificial neural network (ANN) to directly predict σmin and σmax from the drilling data; which are injection rate (Q), standpipe pressure (SPP), weight on bit (WOB), torque (T), and rate of penetration (ROP). Such data are always available while drilling, and hence, no additional cost is required. Actual data from a Middle Eastern field were collected, statistically analyzed, and fed to the models. First, the models’ predictions showed a significant match with the actual stress values with a correlation coefficient (R-value) exceeding 0.90 and a mean absolute average error (MAPE) of 0.75% as a maximum. Second, new empirical equations were generated based on the developed ANN-based models. The new equations were then validated using another unseen dataset from the same field. The predictions had an R-value of 0.98 and 0.93 in addition to MAPE of 0.36% and 0.96% for σmin and σmax models, respectively. The results demonstrated the outperformance of the developed ANN-based equations to estimate the least principal stresses from the drilling data with high accuracy in a timely and economically effective way.


---

## Body

## 1. Introduction

### 1.1. Background

The in situ stress state of earth’s subterranean formations can be defined by three mutually orthogonal stress components. These principal stresses are the vertical stress (σv) and the least principal stresses; the maximum horizontal stress (σmax) and the minimum horizontal stress (σmin). Based on the relative magnitude of the three principle stresses, the stress regime can be classified to normal faulting (σv > σmax > σmin), strike-slip (σmax>σv> σmin), and thrust faulting (σv > σmin > σmax) [1].Estimation of these stresses is substantial for well planning since it defines the stress concentration around the wellbore. Therefore, it has a great impact on the optimization of the drilling process and maintaining the well integrity [2]. The availability of such information could help avoid many drilling-related issues such as stuck pipe and loss of circulation, by helping better design the safe drilling window, stable drilling trajectories, and set safe casing setting depths. [1].The vertical stress (σv) at a certain depth can be calculated using the densities of the overlying formations that could be obtained from the density log [3]. The minimum horizontal stress (σmin) can be directly measured by employing some field tests, i.e., leak-off test, minifrac test, and step-rate test, [1, 4, 5]. Unlike σmin, the maximum horizontal stress (σmax) is commonly estimated based on the values of σv and σmin, using some theoretical and empirical correlations [6, 7]. Since the field tests applied to measure σmin are costly, time-consuming, and only applied at specific depths, different theoretical models have been developed, i.e., poroelastic strain models, to estimate the downhole stresses indirectly [1, 8–11]. Such models are based on the in situ measurements of some geomechanical parameters such as static elastic modulus, static Poisson’s ratio, and elastic strains. These parameters are accurately measured in the lab of retrieved core samples that imitate the in situ conditions of the downhole formations [10]. To have a continuous profile of such geomechanical parameters, such lab measurements are correlated to the continuous logging data. Furthermore, at least one direct field test, i.e., leak-off test, should be conducted to calibrate these profiles and the effect of the tectonic stresses should be included so that they would effectively represent the in situ stress state of the downhole formations [12–14]. However, the well-logging process is commonly applied after drilling the wellbore to avoid the harsh drilling environment [15]. Thus, the logging data are not always accessible while drilling which would accordingly hinder the real-time estimation of the in situ stress state of the downhole formations. The availability of downhole stresses data during drilling is very crucial to optimize the drilling operation, reduce the nonproductive time (NPT), and prevent the collapse of downhole formations, so that the well integrity would be maintained.During the drilling process, many sensors are installed to measure different parameters that reflect the performance of the drilling operation and the nature of the drilled formations. These parameters, known as the drilling parameters, include injection rate (Q), standpipe pressure (SPP), weight on bit (WOB), torque (T), and rate of penetration (ROP). Such data are always available while drilling and vary based on the properties of the drilled formations. The drilling parameters (Q, SPP, T, WOB, and ROP) practically reflect the drillability of the downhole formations. How easily the formations can be drilled is directly controlled by the stress concentration around the wellbore which is the key factor for the stability of the wellbore while drilling and maintaining its integrity [16]. The stress concentration around the wellbore is basically described by the hoop and radial stresses that are calculated based on the least principal stress values [10]. Practically, the two parameters, namely, WOB and Q, are controlled during the drilling operations. The initial values for these parameters are usually set based on the data available from offset wells and the experience of the drilling engineer with the area. Then, the set values of these parameters would be adjusted while drilling according to the drillability of the downhole formations which mainly depend on the stress concentration around the wellbore [17, 18]. Accordingly, this would be translated into the measured values of SPP, T, and ROP. For instance, the drillability of highly stressed formations such as shale would be different from normally stressed zones, and this would require adjusting the controlled drilling parameters accordingly. However, the shape of the downhole cuttings would be different, and in turn, the applied pumping rate (Q) would be adjusted to adapt such changes and achieve effective hole cleaning. Similarly, as the formation stress increases, it becomes difficult to drill, so higher WOB is required for effective rock crushing. Following this look, the drilling parameters, in practice, are usually adjusted according to the drillability of the formations.Many studies have used such drilling parameters to estimate different mechanical properties of the downhole formations such as unconfined compressive strength, elastic moduli, and Poisson’s ratio [19–22]. Recently, several machine learning (ML) techniques have been applied on a wide scale in the petroleum industry [23–26]. These applications aim at the best use of the big data available and support the fourth revolution for drilling automation and optimization.Minimum horizontal stress (σmin) and the maximum horizontal stress (σmax) of downhole formations are essential for the design and optimization of the drilling process in addition to designing hydraulic fracturing operations. Theoretical equations can be used to estimate σmin and σmax. These equations depend on some field tests, i.e., leak-off test to include the effect of tectonic stress. In addition, some in-situ geomechanical parameters can be estimated using retrieved core samples, and then the experimental results will be used to calibrate the logging data to have a continuous profile. Hence, this approach has many technical and financial issues. Therefore, the main objective of this study is to apply an ML approach i.e., artificial neural network (ANN) to predict the least principal stresses σmin and σmax using readily available drilling parameters. Then, state-of-the-art equations would be developed (a white-box model) to estimate the least principal stresses directly from the drilling data, based on the developed ML models. This would help provide a continuous profile of σmin and σmax directly while drilling without any additional costs in a timely and effective way.


### 1.2. Stresses Determination

In this study, the poroelastic model was used to determine the least principal stresses from (1) and (2) [9, 16].(1)σmin=PRs1−PRsσv−PRs1−PRsαPf+αPf+Es1−PRs2εx+PRs×Es1−PRs2εy,(2)σmax=PRs1−PRsσv−PRs1−PRsαPf+αPf+Es1−PRs2εy+PRs×Es1−PRs2εx,where PRs is the static Poisson’s ratio; σv is the vertical (overburden) stress component; α is Biot’s elastic coefficient; and εx and εy are the elastic strains in the σmin and σmax directions, respectively.The overburden stressσv was firstly estimated using the formation bulk-density log (RHOB) along the depth of interest using the following equation:(3)σv=∫0zρzgdz,where ρz is the formation density at a certain depth of z and g is the gravitational acceleration.Secondly, the acoustic and RHOB logs were used to estimate the dynamic elastic modulus (Ed) and dynamic Poisson’s ratio (PRd). Since the wellbore failure is slow and the wave propagation in the layers is a high-frequency phenomenon, Ed was transformed to the static elastic modulus (Es) [27, 28]. Thus, Es values were correlated with Ed using the lab measurements of the retrieved core samples from the wells.The elastic strainsεx and εy were initially considered equal in equation (1) to estimate initial values of σmin. The minimum horizontal stress was then calibrated using an in situ field test; leak-off test. The ratio (εx/εy) varied iteratively to achieve an acceptable match between the calculated and measured σmin values. Finally, the σmin and σmax profiles were generated and used as the outputs for the proposed models. Figure 1 shows the generated principal stress profiles for the area under study along the depth of interest. It is clear from Figure 1 that the stress regime in the presented case is normal faulting where σv > σmax > σmin.Figure 1
Principal stress profile for the area under study.


## 1.1. Background

The in situ stress state of earth’s subterranean formations can be defined by three mutually orthogonal stress components. These principal stresses are the vertical stress (σv) and the least principal stresses; the maximum horizontal stress (σmax) and the minimum horizontal stress (σmin). Based on the relative magnitude of the three principle stresses, the stress regime can be classified to normal faulting (σv > σmax > σmin), strike-slip (σmax>σv> σmin), and thrust faulting (σv > σmin > σmax) [1].Estimation of these stresses is substantial for well planning since it defines the stress concentration around the wellbore. Therefore, it has a great impact on the optimization of the drilling process and maintaining the well integrity [2]. The availability of such information could help avoid many drilling-related issues such as stuck pipe and loss of circulation, by helping better design the safe drilling window, stable drilling trajectories, and set safe casing setting depths. [1].The vertical stress (σv) at a certain depth can be calculated using the densities of the overlying formations that could be obtained from the density log [3]. The minimum horizontal stress (σmin) can be directly measured by employing some field tests, i.e., leak-off test, minifrac test, and step-rate test, [1, 4, 5]. Unlike σmin, the maximum horizontal stress (σmax) is commonly estimated based on the values of σv and σmin, using some theoretical and empirical correlations [6, 7]. Since the field tests applied to measure σmin are costly, time-consuming, and only applied at specific depths, different theoretical models have been developed, i.e., poroelastic strain models, to estimate the downhole stresses indirectly [1, 8–11]. Such models are based on the in situ measurements of some geomechanical parameters such as static elastic modulus, static Poisson’s ratio, and elastic strains. These parameters are accurately measured in the lab of retrieved core samples that imitate the in situ conditions of the downhole formations [10]. To have a continuous profile of such geomechanical parameters, such lab measurements are correlated to the continuous logging data. Furthermore, at least one direct field test, i.e., leak-off test, should be conducted to calibrate these profiles and the effect of the tectonic stresses should be included so that they would effectively represent the in situ stress state of the downhole formations [12–14]. However, the well-logging process is commonly applied after drilling the wellbore to avoid the harsh drilling environment [15]. Thus, the logging data are not always accessible while drilling which would accordingly hinder the real-time estimation of the in situ stress state of the downhole formations. The availability of downhole stresses data during drilling is very crucial to optimize the drilling operation, reduce the nonproductive time (NPT), and prevent the collapse of downhole formations, so that the well integrity would be maintained.During the drilling process, many sensors are installed to measure different parameters that reflect the performance of the drilling operation and the nature of the drilled formations. These parameters, known as the drilling parameters, include injection rate (Q), standpipe pressure (SPP), weight on bit (WOB), torque (T), and rate of penetration (ROP). Such data are always available while drilling and vary based on the properties of the drilled formations. The drilling parameters (Q, SPP, T, WOB, and ROP) practically reflect the drillability of the downhole formations. How easily the formations can be drilled is directly controlled by the stress concentration around the wellbore which is the key factor for the stability of the wellbore while drilling and maintaining its integrity [16]. The stress concentration around the wellbore is basically described by the hoop and radial stresses that are calculated based on the least principal stress values [10]. Practically, the two parameters, namely, WOB and Q, are controlled during the drilling operations. The initial values for these parameters are usually set based on the data available from offset wells and the experience of the drilling engineer with the area. Then, the set values of these parameters would be adjusted while drilling according to the drillability of the downhole formations which mainly depend on the stress concentration around the wellbore [17, 18]. Accordingly, this would be translated into the measured values of SPP, T, and ROP. For instance, the drillability of highly stressed formations such as shale would be different from normally stressed zones, and this would require adjusting the controlled drilling parameters accordingly. However, the shape of the downhole cuttings would be different, and in turn, the applied pumping rate (Q) would be adjusted to adapt such changes and achieve effective hole cleaning. Similarly, as the formation stress increases, it becomes difficult to drill, so higher WOB is required for effective rock crushing. Following this look, the drilling parameters, in practice, are usually adjusted according to the drillability of the formations.Many studies have used such drilling parameters to estimate different mechanical properties of the downhole formations such as unconfined compressive strength, elastic moduli, and Poisson’s ratio [19–22]. Recently, several machine learning (ML) techniques have been applied on a wide scale in the petroleum industry [23–26]. These applications aim at the best use of the big data available and support the fourth revolution for drilling automation and optimization.Minimum horizontal stress (σmin) and the maximum horizontal stress (σmax) of downhole formations are essential for the design and optimization of the drilling process in addition to designing hydraulic fracturing operations. Theoretical equations can be used to estimate σmin and σmax. These equations depend on some field tests, i.e., leak-off test to include the effect of tectonic stress. In addition, some in-situ geomechanical parameters can be estimated using retrieved core samples, and then the experimental results will be used to calibrate the logging data to have a continuous profile. Hence, this approach has many technical and financial issues. Therefore, the main objective of this study is to apply an ML approach i.e., artificial neural network (ANN) to predict the least principal stresses σmin and σmax using readily available drilling parameters. Then, state-of-the-art equations would be developed (a white-box model) to estimate the least principal stresses directly from the drilling data, based on the developed ML models. This would help provide a continuous profile of σmin and σmax directly while drilling without any additional costs in a timely and effective way.


## 1.2. Stresses Determination

In this study, the poroelastic model was used to determine the least principal stresses from (1) and (2) [9, 16].(1)σmin=PRs1−PRsσv−PRs1−PRsαPf+αPf+Es1−PRs2εx+PRs×Es1−PRs2εy,(2)σmax=PRs1−PRsσv−PRs1−PRsαPf+αPf+Es1−PRs2εy+PRs×Es1−PRs2εx,where PRs is the static Poisson’s ratio; σv is the vertical (overburden) stress component; α is Biot’s elastic coefficient; and εx and εy are the elastic strains in the σmin and σmax directions, respectively.The overburden stressσv was firstly estimated using the formation bulk-density log (RHOB) along the depth of interest using the following equation:(3)σv=∫0zρzgdz,where ρz is the formation density at a certain depth of z and g is the gravitational acceleration.Secondly, the acoustic and RHOB logs were used to estimate the dynamic elastic modulus (Ed) and dynamic Poisson’s ratio (PRd). Since the wellbore failure is slow and the wave propagation in the layers is a high-frequency phenomenon, Ed was transformed to the static elastic modulus (Es) [27, 28]. Thus, Es values were correlated with Ed using the lab measurements of the retrieved core samples from the wells.The elastic strainsεx and εy were initially considered equal in equation (1) to estimate initial values of σmin. The minimum horizontal stress was then calibrated using an in situ field test; leak-off test. The ratio (εx/εy) varied iteratively to achieve an acceptable match between the calculated and measured σmin values. Finally, the σmin and σmax profiles were generated and used as the outputs for the proposed models. Figure 1 shows the generated principal stress profiles for the area under study along the depth of interest. It is clear from Figure 1 that the stress regime in the presented case is normal faulting where σv > σmax > σmin.Figure 1
Principal stress profile for the area under study.


## 2. Data Analysis and Processing

### 2.1. Data Description

Field data representing a complex carbonate reservoir were collected from two wells, Well A and Well B, in a Middle Eastern field. The data, 2187 data points, involve the drilling data and the corresponding in situ minimum and maximum horizontal stresses,σmin and σmax. The drilling data comprise Q, SPP, WOB, T, and ROP. The data from Well A were used for building the models, while the data from Well B were used for the verification process of the developed models.The statistical analysis listed in Table1 shows different descriptive measures, i.e., range, mean, standard deviation (STD), and skewness. These measures gave descriptive insights about the data distribution and coverage. Having a wide data range with a representative distribution, as listed in Table 1, a substantial base is provided to develop a reliable model that could capture the nature of the problem with more confidence. The ranges of the data are as follows: Q, 191.54–289.92 gpm; SPP, 1748.58–3252.60 psi; T, 2.60–3.79 kft.lbf; WOB, 5.75–18.94 klb; ROP, 3.20–73.17 ft/hr; σmin, 11240.43–12361.17 psi; and σmax, 12308.02–14599.67 psi. Figure 2 shows a graphical distribution of the drilling data used as inputs for the proposed model.Table 1
Descriptive statistical analysis of the dataset used in this study.
ParameterQ (gpm)SPP(psi)T (kft.lbf)WOB (klb)ROP (ft/hr)σmin (psi)σmzx (psi)Minimum191.541748.582.605.753.2011240.4312308.02Maximum289.923252.603.7918.9473.1712361.1714599.67Range98.381504.021.1913.1969.971120.742291.65Mean242.152759.523.0710.3122.2711855.7013731.48STD20.12342.650.263.1012.02302.36487.08Skewness−1.31−1.120.950.761.05−0.15−0.42Figure 2
Graphical presentation for the drilling data used for building the ANN models.A specially designed Python code was developed to preprocess the data. First, the dataset was filtered from any missing data, duplicated information, negative values, and unreasonable values that violate the engineering sense. Then, the data outliers were removed using different approaches, i.e., moving mean and quartiles. The data preprocessing step is crucial for enhancing the quality of the data and in turn increases the potential to have an accurate predictive model [29].The relative dependency of the output was then studied with each input parameter using Pearson’s correlation coefficient (R-value). The R-value ranges from −1 to +1 in the way that the higher the R-value is, the stronger the linear relationship exists. Positive R-values indicate a direct relationship, while negative R-values indicate an inverse relationship between the input and the output parameters. R-values approaching zero show almost no linear relationship between the two parameters [30]. As shown in Figure 3, σmin data have R-values of 0.65, 0.85, 0.59, 0.64, and −0.48 with Q, SPP, T, WOB, and ROP, respectively. Similarly, σmax has relatively high positive R-values almost exceeding 0.50 with all the inputs except −0.34 with ROP. This indicates the noticeable dependence of both σmin and σmax on the selected input features. The uniqueness of the ML is that ML can be able to find the direct and the indirect relationships between the input and the output parameters. To the best of the author’s knowledge, there is no direct relationship between the drilling parameters and the in situ stresses; however, as the formation stress increases, the drillability of the formation decreases [17]. [31–34] showed that rock cuttability decreased in the stressed formations. And that can be translated to lower ROP and higher T as the formation stress increases. Moreover, as the formation becomes difficult to be drill, higher WOB and horse power (Q∗SPP) is required to drill the formation, which is in agreement with the correlation coefficient result that is shown in Figure 3.Figure 3
A graphical presentation of the correlation coefficient R-value betweenσmin and σmax with input data (drilling data).


## 2.1. Data Description

Field data representing a complex carbonate reservoir were collected from two wells, Well A and Well B, in a Middle Eastern field. The data, 2187 data points, involve the drilling data and the corresponding in situ minimum and maximum horizontal stresses,σmin and σmax. The drilling data comprise Q, SPP, WOB, T, and ROP. The data from Well A were used for building the models, while the data from Well B were used for the verification process of the developed models.The statistical analysis listed in Table1 shows different descriptive measures, i.e., range, mean, standard deviation (STD), and skewness. These measures gave descriptive insights about the data distribution and coverage. Having a wide data range with a representative distribution, as listed in Table 1, a substantial base is provided to develop a reliable model that could capture the nature of the problem with more confidence. The ranges of the data are as follows: Q, 191.54–289.92 gpm; SPP, 1748.58–3252.60 psi; T, 2.60–3.79 kft.lbf; WOB, 5.75–18.94 klb; ROP, 3.20–73.17 ft/hr; σmin, 11240.43–12361.17 psi; and σmax, 12308.02–14599.67 psi. Figure 2 shows a graphical distribution of the drilling data used as inputs for the proposed model.Table 1
Descriptive statistical analysis of the dataset used in this study.
ParameterQ (gpm)SPP(psi)T (kft.lbf)WOB (klb)ROP (ft/hr)σmin (psi)σmzx (psi)Minimum191.541748.582.605.753.2011240.4312308.02Maximum289.923252.603.7918.9473.1712361.1714599.67Range98.381504.021.1913.1969.971120.742291.65Mean242.152759.523.0710.3122.2711855.7013731.48STD20.12342.650.263.1012.02302.36487.08Skewness−1.31−1.120.950.761.05−0.15−0.42Figure 2
Graphical presentation for the drilling data used for building the ANN models.A specially designed Python code was developed to preprocess the data. First, the dataset was filtered from any missing data, duplicated information, negative values, and unreasonable values that violate the engineering sense. Then, the data outliers were removed using different approaches, i.e., moving mean and quartiles. The data preprocessing step is crucial for enhancing the quality of the data and in turn increases the potential to have an accurate predictive model [29].The relative dependency of the output was then studied with each input parameter using Pearson’s correlation coefficient (R-value). The R-value ranges from −1 to +1 in the way that the higher the R-value is, the stronger the linear relationship exists. Positive R-values indicate a direct relationship, while negative R-values indicate an inverse relationship between the input and the output parameters. R-values approaching zero show almost no linear relationship between the two parameters [30]. As shown in Figure 3, σmin data have R-values of 0.65, 0.85, 0.59, 0.64, and −0.48 with Q, SPP, T, WOB, and ROP, respectively. Similarly, σmax has relatively high positive R-values almost exceeding 0.50 with all the inputs except −0.34 with ROP. This indicates the noticeable dependence of both σmin and σmax on the selected input features. The uniqueness of the ML is that ML can be able to find the direct and the indirect relationships between the input and the output parameters. To the best of the author’s knowledge, there is no direct relationship between the drilling parameters and the in situ stresses; however, as the formation stress increases, the drillability of the formation decreases [17]. [31–34] showed that rock cuttability decreased in the stressed formations. And that can be translated to lower ROP and higher T as the formation stress increases. Moreover, as the formation becomes difficult to be drill, higher WOB and horse power (Q∗SPP) is required to drill the formation, which is in agreement with the correlation coefficient result that is shown in Figure 3.Figure 3
A graphical presentation of the correlation coefficient R-value betweenσmin and σmax with input data (drilling data).


## 3. Model Development

The data collected from Well A were used for building the proposed ANN models to predictσmin and σmax as outputs based on the drilling data as inputs.


### 3.1. Artificial Neural Network (ANN)

ANN is a supervised-learning ML approach that is capable of dealing with highly complex problems. Based on the literature, ANN has been widely applied in many petroleum-related applications such as the predictions of the mechanical properties of the downhole formations based on the drilling parameters. Examples of these applications are the prediction of Poisson’s ratio and unconfined compressive strength (UCS) [21, 35–38]. The typical structure of ANN architecture comprises three basic types of layers: input layer, hidden layer(s), and output layer. Building an ANN-based model involves processing the data through these layers starting from the input layer, then the neurons in the hidden layer(s), and eventually resulting in the target in the output layer [39]. The connections between the layers are typically controlled by a set of weights and biases that are updated iteratively during the optimization process to ultimately achieve the lowest possible loss in the objective function [40, 41].


### 3.2. Stresses Prediction Using ANN-Based Model

In this study, new ANN-based models were developed to estimateσmin and σmax based on the drilling data as inputs. A MATLAB code was developed to randomly divide the selected dataset into two groups: 80% of the data for training and 20% testing. The training set was used to train the model to optimize its hyperparameters. During the optimization process, the results of the models were internally tested to evaluate the selected hyperparameters. For each trial, the predictions were evaluated using the R-value and the mean absolute percentage error (MAPE) between the actual and predicted output values for the training and testing processes. The objective of this step is to identify the hyperparameters that could achieve the lowest possible prediction error through many iterative trials. Afterwards, the model with the optimized hyperparameters was evaluated using the testing set to estimate the generalization error of the optimized model [42]. Different options of the ANN parameters were tested to optimize the network. These parameters are the number of hidden layers, number of neurons in each hidden layer, training algorithms, transfer functions, and the learning rate. Table 2 lists the tested options of the network parameters for optimizing the developed ANN-based models. Figure 4 summarizes the workflow adopted while developing the ANN models.Table 2
Summary of the optimization process of the developed ANN-based model.
ParameterOptimized parametersσmin modelσmax modelNumber of hidden layersSingle hidden layerNumber of neurons in each layer1535Split ratio(Training/testing)0.8/0.2Training algorithmsTrainlmTransfer functionLogsigTansigLearning rate0.12Figure 4
A flowchart for the workflow followed while developing the ANN-based models.


## 3.1. Artificial Neural Network (ANN)

ANN is a supervised-learning ML approach that is capable of dealing with highly complex problems. Based on the literature, ANN has been widely applied in many petroleum-related applications such as the predictions of the mechanical properties of the downhole formations based on the drilling parameters. Examples of these applications are the prediction of Poisson’s ratio and unconfined compressive strength (UCS) [21, 35–38]. The typical structure of ANN architecture comprises three basic types of layers: input layer, hidden layer(s), and output layer. Building an ANN-based model involves processing the data through these layers starting from the input layer, then the neurons in the hidden layer(s), and eventually resulting in the target in the output layer [39]. The connections between the layers are typically controlled by a set of weights and biases that are updated iteratively during the optimization process to ultimately achieve the lowest possible loss in the objective function [40, 41].


## 3.2. Stresses Prediction Using ANN-Based Model

In this study, new ANN-based models were developed to estimateσmin and σmax based on the drilling data as inputs. A MATLAB code was developed to randomly divide the selected dataset into two groups: 80% of the data for training and 20% testing. The training set was used to train the model to optimize its hyperparameters. During the optimization process, the results of the models were internally tested to evaluate the selected hyperparameters. For each trial, the predictions were evaluated using the R-value and the mean absolute percentage error (MAPE) between the actual and predicted output values for the training and testing processes. The objective of this step is to identify the hyperparameters that could achieve the lowest possible prediction error through many iterative trials. Afterwards, the model with the optimized hyperparameters was evaluated using the testing set to estimate the generalization error of the optimized model [42]. Different options of the ANN parameters were tested to optimize the network. These parameters are the number of hidden layers, number of neurons in each hidden layer, training algorithms, transfer functions, and the learning rate. Table 2 lists the tested options of the network parameters for optimizing the developed ANN-based models. Figure 4 summarizes the workflow adopted while developing the ANN models.Table 2
Summary of the optimization process of the developed ANN-based model.
ParameterOptimized parametersσmin modelσmax modelNumber of hidden layersSingle hidden layerNumber of neurons in each layer1535Split ratio(Training/testing)0.8/0.2Training algorithmsTrainlmTransfer functionLogsigTansigLearning rate0.12Figure 4
A flowchart for the workflow followed while developing the ANN-based models.


## 4. Results and Discussion

### 4.1.σmin Prediction Model

The developed model was trained using the Levenberg–Marquardt algorithm (trainlm) to tune the ANN parameters. Different hyperparameters were tested to optimize the architecture of the ANN-based model. Different numbers of hidden layers were tested between single to four layers, and the optimized number was selected to be a single layer. The number of neurons was selected to be 15 neurons after testing the number of the neurons between 5 and 40 neurons. Different training to testing splitting ratios from 60/40 to 90/10 were tested. The best model performance was found with an 80/20 splitting ratio. The optimized training algorithm and transfer function were found to be trainlm and Log-sigmoidal transfer function (logsig) for the input layer, respectively. The learning rate of the ANN model was selected to be 0.12.Figure5 shows a typical architecture of the developed ANN-based model. A significant match was found between the predicted and actual σmin as shown in Figure 6, confirmed by the R-value of 0.98 and 0.97 MAPE not exceeding 0.36% both for the training and testing processes, respectively.Figure 5
A typical architecture of the developed ANN-based models.Figure 6
Crossplots between the actual and predictedσmin using the developed ANN-based model for (a) training and (b) testing processes.
(a)(b)


### 4.2.σmax Prediction Model

Similarly, another model was developed using ANN to predictσmax based on the drilling parameters. The optimization process of the σmax model yielded a network structure of a single hidden layer with 35 neurons. A tan-sigmoidal transfer function was used for the input layer, while a linear function was selected for the output layer using the “trainlm” algorithm for training the model. The predictions of the developed model showed a narrow scatter around the 45 lines of the crossplots between the actual and the predicted σmax values as shown in Figure 7. This indicates the high accuracy of the model predictions that is confirmed by the low MAPE of 0.74%, and 0.75% for the training and testing processes, respectively. Besides, the high R-value exceeds 0.90 for both. The summary of the prediction evaluation of the developed models is listed in Table 3, in terms of R-value, MAPE, and root-mean squared error (RMSE) for both the training and testing processes.Figure 7
Crossplots between the actual and predictedσmax for the developed ANN-based model for (a) training and (b) testing processes.
(a)(b)Table 3
Summary of the performance of the developed ANN-based models.
ModelTraining ProcessTesting ProcessR-valueMAPE (%)RMSER-valueMAPE (%)RMSEσmin0.980.3660.370.970.2948.57σmax0.960.74136.250.960.75129.51


## 4.1.σmin Prediction Model

The developed model was trained using the Levenberg–Marquardt algorithm (trainlm) to tune the ANN parameters. Different hyperparameters were tested to optimize the architecture of the ANN-based model. Different numbers of hidden layers were tested between single to four layers, and the optimized number was selected to be a single layer. The number of neurons was selected to be 15 neurons after testing the number of the neurons between 5 and 40 neurons. Different training to testing splitting ratios from 60/40 to 90/10 were tested. The best model performance was found with an 80/20 splitting ratio. The optimized training algorithm and transfer function were found to be trainlm and Log-sigmoidal transfer function (logsig) for the input layer, respectively. The learning rate of the ANN model was selected to be 0.12.Figure5 shows a typical architecture of the developed ANN-based model. A significant match was found between the predicted and actual σmin as shown in Figure 6, confirmed by the R-value of 0.98 and 0.97 MAPE not exceeding 0.36% both for the training and testing processes, respectively.Figure 5
A typical architecture of the developed ANN-based models.Figure 6
Crossplots between the actual and predictedσmin using the developed ANN-based model for (a) training and (b) testing processes.
(a)(b)


## 4.2.σmax Prediction Model

Similarly, another model was developed using ANN to predictσmax based on the drilling parameters. The optimization process of the σmax model yielded a network structure of a single hidden layer with 35 neurons. A tan-sigmoidal transfer function was used for the input layer, while a linear function was selected for the output layer using the “trainlm” algorithm for training the model. The predictions of the developed model showed a narrow scatter around the 45 lines of the crossplots between the actual and the predicted σmax values as shown in Figure 7. This indicates the high accuracy of the model predictions that is confirmed by the low MAPE of 0.74%, and 0.75% for the training and testing processes, respectively. Besides, the high R-value exceeds 0.90 for both. The summary of the prediction evaluation of the developed models is listed in Table 3, in terms of R-value, MAPE, and root-mean squared error (RMSE) for both the training and testing processes.Figure 7
Crossplots between the actual and predictedσmax for the developed ANN-based model for (a) training and (b) testing processes.
(a)(b)Table 3
Summary of the performance of the developed ANN-based models.
ModelTraining ProcessTesting ProcessR-valueMAPE (%)RMSER-valueMAPE (%)RMSEσmin0.980.3660.370.970.2948.57σmax0.960.74136.250.960.75129.51


## 5. Empirical Equations for Estimatingσmin and σmax

This study aims at introducing ML-based models to predictσmin and σmax in a white-box model to demulsify the black-box nature of the ML models. Therefore, the weights and biases of the optimized models were extracted to imitate the workflow of the developed ANN models. Accordingly, new equations, equations (4) and (5), were developed to estimate σmin and σmax, respectively:(4)σmin=560.37×σminnormalized+11800.80,(5)σmax=1145.83×σmaxnormalized+13453.84,where (σmin)normalized and (σmax)normalized are the normalized forms of σmin andσmax, respectively.As a first procedure to use the ANN-based equations, the input parameters should be initially normalized using the following equation:(6)Xnormalized=2×X−XminXmax−Xmin−1,where X is the actual value of the input parameter, Xmin and Xmax are the minimum and maximum values of the input parameter, respectively, and Xnormalized is the normalized form of the input parameter. The minimum and maximum values of each parameter are listed in Table 1. Equations (7) and (8) are used to calculate the normalized forms of σmin and σmax to substitute (σmin)normalized and (σmax)normalized in Equation (4) and (5):(7)σminnormalized=∑i=1kw2,i11+e−w1i,1×Qn+w1i,2×SPPn+w1i,3×WOBn+w1i,4×Tn+w1i,5×ROPn+b1,i+b2,(8)σmaxnormalized=∑i=1kw2,i21+e−2w1i,1×Qn+w1i,2×SPPn+w1i,3×WOBn+w1i,4×Tn+w1i,5×ROPn+b1,i−1+b2,where k is the total number of neurons in the hidden layer; w2is the vector of the optimized weights between the hidden layer and the output layer; w1 is the matrix of the optimized weights between the hidden layer and the input layer; b1 is the vector of the optimized biases between the hidden layer and the input layer; and b2 is the optimized bias between the hidden layer and the output layer. Qn, SPPn, WOBn, Tn, and ROPn are the normalized forms of the input parameters and can be calculated using Equation (6). The optimized weights and biases extracted from the developed ANN-based σmin and σmax models are listed in Tables 4 and 5, respectively. This is to substitute the weights and biases in Equations (7) and (8). The input parameters should be measured in the following units: Q in gpm, SPP in psi, WOB in klb, T in klb.ft, and ROP in ft/hr.Table 4
The optimized weights and biases of the developed ANN-based model to predictσmin.
IW1i,jW2ib1,ib2j = 1j = 2j = 3j = 4j = 510.653−2.0176.168−6.4672.957−0.3630.3790.4812−3.7317.783−0.918−0.9880.579−2.357−2.552311.8809.9081.9021.074−4.115−3.858−5.1354−0.9567.366−0.9530.7133.2761.281−1.13554.8168.946−2.2180.1701.409−3.243−2.5716−4.431−1.371−1.022−2.5370.786−2.683−0.3977−0.3390.7331.2503.4441.3011.464−1.01181.5200.881−1.0251.345−0.458−6.470−0.439913.90711.9341.5740.449−4.2624.254−6.812101.0468.303−3.238−0.3670.4035.115−2.807112.0972.800−1.3990.553−0.7194.314−3.12912−1.530−0.759−2.5161.3980.005−1.6180.148133.257−0.0221.328−0.005−0.315−6.300−1.223143.930−5.0953.6170.298−1.2852.6110.732151.1214.980−3.3890.0460.6503.9104.241Table 5
The optimized weights and biases of the developed ANN-based model to predictσmax.
IW1i,jW2ib1,ib2j = 1j = 2j = 3j = 4j = 51−5.2880.9740.115−0.1240.2372.121−0.6331.7722−0.0203.4972.1570.1572.459−0.8571.6063−4.615−0.558−0.7430.988−0.925−1.908−0.0924−2.858−0.075−2.3730.783−1.055−1.383−0.5095−1.201−1.491−0.970−0.522−0.8853.055−0.0356−0.7561.8044.2021.636−1.0231.8353.5997−0.002−1.251−4.7402.218−0.4991.323−1.9718−4.0881.2462.770−0.5890.330−2.0591.53992.1961.176−1.558−2.904−2.8900.6591.519100.5191.456−1.6241.092−0.417−2.3930.74711−3.117−2.333−1.600−0.911−0.393−1.5370.21812−0.0260.4952.6981.203−0.665−3.3432.08713−3.1890.4150.2633.192−0.008−1.3781.88714−2.6271.138−0.152−0.9910.599−2.0800.34515−0.7480.988−0.3622.850−1.0121.3091.78316−1.820−0.3305.310−0.8362.6821.3222.900174.885−0.756−0.698−4.4501.975−0.703−1.525181.6904.334−2.0652.208−0.4492.5560.216192.9660.7471.833−1.345−0.2351.933−2.519200.7101.6350.1420.2342.1671.6640.97421−0.7751.5112.444−1.4230.4992.9181.11822−1.4331.751−0.0982.5740.9241.0490.72723−0.3761.6191.941−1.190−2.214−0.5300.037240.571−0.637−1.5831.3430.394−2.2171.060255.8310.459−0.2800.811−0.423−2.284−2.314263.484−3.7483.357−5.3551.395−0.3550.71227−2.568−1.9660.084−0.359−1.9582.117−0.860221.0830.485−4.0250.816−1.6572.744−2.14229−2.8250.1734.042−0.7500.8572.3372.25430−0.017−1.234−4.583−1.9400.968−1.241−2.621311.081−0.8000.352−1.5580.610−3.1181.44132−2.9561.5700.844−0.1730.263−2.507−1.213330.958−0.2031.742−1.198−1.032−2.362−1.351342.3376.044−1.4941.849−0.748−1.676−0.694351.2360.410−0.855−2.636−0.2130.8560.355


## 6. Model Verification

To verify the performance of the novel ANN-based equations, the dataset from Well B (386 data points) was used to validate the developed equations. The data involved the drilling data (Q, SPP, WOB, T, and ROP) andσmin and σmax at the corresponding depths. The drilling data were used as inputs for the developed equations. Then the results were compared with the actual σmin and σmax values. A remarkable match was noticed between the predicted and the actual σmin and σmax values as shown in Figure 8. The R-value was 0.98 and 0.93 for σmin and σmax predictions, respectively. The MAPE did not exceed 0.96% for both. These results revealed the outperforming accuracy of the developed ANN-based equations to estimate σmin and σmax from the drilling data and provided the capability of generating a real-time stress profile for the downhole formations while drilling.Figure 8
Prediction performance of the developed ANN-based equations (actual vs. predicted stresses) for the verification process: (a)σmin prediction (b) σmax prediction.
(a)(b)It should be highlighted that the application of the developed equations is recommended only for carbonate formations because different responses in the drilling data, mechanical properties, and stress concentrations may be encountered for other types of formations. Furthermore, it is recommended to have the inputs within the same range and units listed in Table1 to ensure reliable results.


## 7. Conclusions

In this study, new ML-based models were developed using ANN to predictσmin and σmax of the downhole formations using the readily available drilling data, namely, Q, SPP, T, WOB, and ROP, as inputs. The outcomes of this study are summarized as follows:(i)
The developed ANN-based models predicted the stress values with accuracy exceeding 90% and mean absolute percentage error (MAPE) of 0.75% compared to the actual values.(ii)
Novel equations were extracted from the developed ANN-based models to estimateσmin and σmax using the optimized weights and biases of the ANN models.(iii)
The extracted ANN-based equations were validated using unseen data from the same field, where the MAPE did not exceed 0.96%.The results demonstrated the robustness of the ANN model to predictσmin and σmax from the drilling data to provide continuous profiles of these stresses while drilling and in turn help avoid many wellbore-instability issues in addition to maintaining the well integrity.The current study uses the drilling parameters to predict the maximum and minimum horizontal stresses. The drilling data were collected from real-time sensors after optimizing the controllable drilling parameters such as WOB, RFP, and flow rate.



---

*Source: 8865827-2021-11-30.xml*