# Prediction of Horizontal in Situ Stress in Shale Reservoirs Based on Machine Learning Models
## 1 Introduction  
As global fossil fuel consumption keeps rising, unconventional natural gas has become crucial in exploration and development and will drive future oil and gas production growth [1, 2, 3]. The marine shale gas in Sichuan Basin, a key source of China's natural gas increase, is under wide attention for its development potential [4, 5, 6, 7, 8]. Stress field research is vital for shale gas development. horizontal stress distribution and magnitude affect wellbore stability and hydraulic fracturing design and are key for optimizing drilling and production strategies [9, 10, 11, 12]. In the last few decades, accurate prediction of horizontal in situ stress in shale reservoirs has been a hot topic in geomechanics and reservoir engineering [13, 14, 15, 16]. Conventionalwell-logging interpretation has much experience in assessing underground geological properties. However, due to the high nonlinearity and complexity of geological structures, these methods cannot fully capture the factors affecting stress distribution [17; 18; 19; 20]. In recent years, advanced computational methods have emerged. Machine-learning algorithms like XGBoost [21], SVM [22], and RF [23] excel in capturing complex nonlinear relationships and processing high-dimensional datasets. They have been successfully applied in hydrocarbon reservoir prediction and geomechanical parameter estimation. However, existing research on horizontal in situ stress prediction for shale reservoirs has several limitations. Some studies rely solely on single-well data, which restricts the model's universality and generalization ability [24; 25; 26]. In feature selection, most works fail to adequately explore the deep-level correlations among different well-logging curves. They only focus on extracting morphological features of well-logging curves and finding nonlinear relationships, neglecting effective screening of key controlling factors [27; 28]. Traditional model optimization methods often cannot achieve global optimality within limited data and computational resources, leading to instability in model performance across different datasets [29; 30; 31]. To address these gaps, this study introduces an innovative approach that integrates conventional well logging interpretation with advanced machine learning techniques for predicting horizontal in situ stress in shale reservoirs. Well logging interpretation provides a reliable dataset and theoretical guidance for the research, while XGBoost, known for its powerful performance, offers accurate and efficient data processing capabilities. The approach consists of three main steps: Initially, using the dataset from well logging interpretation, Pearson correlation coefficients and mutual information analysis are combined with the RF-RFE algorithm to identify the key factors influencing in situ stress. Subsequently, a prediction model is developed with these key factors as inputs and in situ stress as the target output, and Bayesian optimization is employed to adjust the hyperparameters, enhancing the model's global optimization capabilities. Finally, the performance of multiple machine learning models is compared to validate the proposed method's superiority. By addressing the shortcomings of prior studies, this research aims to provide a superior-performing model for in situ stress prediction in shale gas development and to establish a robust theoretical and practical foundation for future related studies. The remainder of this paper is organized as follows: Section 2 outlines the experimental datasets and methods, covering the data source, characteristics, preprocessing, logging interpretation, XGBoost algorithm, RF-RFE feature selection, Bayesian optimization, and baseline models. Section 3 details the machine learning model, including data preprocessing steps and model evaluation metrics. Section 4 presents the results and discussion, comparing different models' prediction performances and exploring their field application implications.