摘要:Rock porosity is an important parameter for the formation evaluation, reservoir modeling, and petroleum reserve estimation. The conventional methods for determining the rock porosity are considered costly and time-consuming operations during the well drilling. This paper aims to predict the rock porosity in real time while drilling complex lithology using machine learning. In this paper, two intelligent models were developed utilizing the random forest (RF) and decision tree (DT) techniques. The drilling parameters include weight on bit, torque, standpipe pressure, drill string rotation speed, rate of penetration, and pump rate. Two datasets were employed for building the models (3767 data points) and for validating the developed models (1676 data points). Both collected datasets have complex lithology of carbonate, sandstone, and shale. Sensitivity and optimization on different parameters for each technique were conducted to ensure optimum prediction. The models’ performance was checked by four performance indices which are coefficient of determination (R2), average absolute percentage error (AAPE), variance account for (VAF), and a20 index. The results indicated the strong porosity prediction capability for the two models. DT model showed R2 of 0.94 and 0.87 between the predicted and actual porosity values with AAPE of 6.07 and 9% for training and testing, respectively. Generally, RF provided a higher level of strong prediction than DT as RF achieved R2 of 0.99 and 0.90 with AAPE of 1.5 and 7% for training and testing, respectively. The models’ validation proved a high prediction performance as DT achieved R2 of 0.88 and AAPE of 8.58%, while RF has R2 of 0.92 and AAPE of 6.5%.