#Pemanggilan Data
kelahiran=read.csv('/home/roni/Downloads/BAYES.csv')
View(kelahiran)
#Library
library(e1071)
library(caret)
## Loading required package: lattice
## Loading required package: ggplot2
#Pengambilan Data Training dan Testing
sampel=sample(1:nrow(kelahiran),0.8*nrow(kelahiran),replace = TRUE)
training=data.frame(kelahiran)[sampel,]
testing=data.frame(kelahiran)[-sampel,]
#Pembuatan Model Naive Bayes
modelNB=naiveBayes(Caesarian~.,data=training)
#Pembuatan Prediksi
prediksi=predict(modelNB,testing)
#Hasil
hasil=confusionMatrix(table(prediksi,testing$Caesarian))
hasil
## Confusion Matrix and Statistics
##
##
## prediksi no yes
## no 8 17
## yes 5 18
##
## Accuracy : 0.5417
## 95% CI : (0.3917, 0.6863)
## No Information Rate : 0.7292
## P-Value [Acc > NIR] : 0.99836
##
## Kappa : 0.1005
##
## Mcnemar's Test P-Value : 0.01902
##
## Sensitivity : 0.6154
## Specificity : 0.5143
## Pos Pred Value : 0.3200
## Neg Pred Value : 0.7826
## Prevalence : 0.2708
## Detection Rate : 0.1667
## Detection Prevalence : 0.5208
## Balanced Accuracy : 0.5648
##
## 'Positive' Class : no
##