Naive Bayes Classifier (NBC) is bayesian algorithm that is used to compute the conditional posterior probabilities of a categorical class variable (Lithofacies) given independent predictor variables (core and well logs data) using the Bayes rule.
NBC was adopted here to model the Lithofacies given core analysis and well logs data from Karpur Dataset: -
Install the packages required to implement NBC algorithm with their functions.
require(e1071)
## Loading required package: e1071
require(MASS)
## Loading required package: MASS
library(e1071)
library(MASS)
Call the dataset and visualize it: -
## depth caliper ind.deep ind.med gamma phi.N R.deep R.med SP
## 1 5667.0 8.685 618.005 569.781 98.823 0.410 1.618 1.755 -56.587
## 2 5667.5 8.686 497.547 419.494 90.640 0.307 2.010 2.384 -61.916
## 3 5668.0 8.686 384.935 300.155 78.087 0.203 2.598 3.332 -55.861
## 4 5668.5 8.686 278.324 205.224 66.232 0.119 3.593 4.873 -41.860
## 5 5669.0 8.686 183.743 131.155 59.807 0.069 5.442 7.625 -34.934
## 6 5669.5 8.686 109.512 75.633 57.109 0.048 9.131 13.222 -39.769
## density.corr density phi.core k.core Facies
## 1 -0.033 2.205 33.9000 2442.590 F1
## 2 -0.067 2.040 33.4131 3006.989 F1
## 3 -0.064 1.888 33.1000 3370.000 F1
## 4 -0.053 1.794 34.9000 2270.000 F1
## 5 -0.054 1.758 35.0644 2530.758 F1
## 6 -0.058 1.759 35.3152 2928.314 F1
Modeling Lithofacies given the other independent variables. Also, predict the 1st 10 observations and plot the boxplot of the predicted lthofacies.
## [1] F10 F3 F3 F1 F1 F1 F1 F1 F1 F1
## Levels: F1 F10 F2 F3 F5 F7 F8 F9
Modeling Validation by computing the total correct percent.
##
## pred F1 F10 F2 F3 F5 F7 F8 F9
## F1 107 3 0 0 0 0 0 0
## F10 1 143 0 28 2 0 0 0
## F2 1 1 8 0 0 0 0 0
## F3 2 20 0 26 1 0 0 0
## F5 0 1 0 1 100 0 4 2
## F7 0 2 0 0 0 9 3 0
## F8 0 1 0 0 0 0 171 0
## F9 0 0 0 0 6 0 6 170
## F1 F10 F2 F3 F5 F7 F8
## 0.9727273 0.8218391 0.8000000 0.5306122 0.9259259 0.6428571 0.9941860
## F9
## 0.9340659
## [1] 0.8962149
Visualizing the predicted posterior distribution of the Eight Facies.
Combining the posterior distribution of the eight Lithofacies in one plot.
References
Murphy, K. P. (2006). Naive bayes classifiers. University of British Columbia.
Karpur, L., L. Lake, and K. Sepehrnoori. (2000). Probability Logs for Facies Classification. In Situ 24(1): 57.
Al-Mudhafer, W. J. (2014). Multinomial Logistic Regression for Bayesian Estimation of Vertical Facies Modeling in Heterogeneous Sandstone Reservoirs. Offshore Technology Conference. doi:10.4043/24732-MS.
Al-Mudhafar, W. J. (2015). Integrating Component Analysis & Classification Techniques for Comparative Prediction of Continuous & Discrete Lithofacies Distributions. Offshore Technology Conference. doi:10.4043/25806-MS.