Beruflich Dokumente
Kultur Dokumente
nb_dat<- print(ConMat2)
naive_bayes(Severityf~BI_RADS+Age+Shape+Margin+Density,dat
a = dat6)
akurasi2 <- (sum(diag(ConMat2)))/sum(ConMat2)
nb_dat
presisi2 <- ConMat2[1,1]/(ConMat2[1,1]+ConMat2[2,1])
recall2 <- ConMat2[1,1]/(ConMat2[1,1]+ConMat2[1,2])
library(e1071) F12 <- (2*presisi2*recall2)/(presisi2+recall2)
Nbayes <- naiveBayes(Severityf~., data=dat6) tpr2<-recall2
Prediction_Nbayes <- predict(Nbayes, test,type="raw“) tnr2<-ConMat2[2,2]/(ConMat2[2,2]+ConMat2[2,1])
Syntax (2)
Prediction <- predict(nb_dat, test)
library(ModelMetrics)
auc_c50 <- auc(test$Severity, Prediction)
#packages ModelMetrics
cat("
AKURASI =",akurasi2,
"
PRESISI =",presisi2,
"
RECALL =",recall2,
"
F1 =",F12,
"
TPR =", tpr2,
"
TNR =", tnr2,
"
AUC =", auc_c50)
Naïve Bayes
Akurasi : 0,8625
Presisi : 0,87037
Recall : 0,85975
F1 : 0,86503
TPR : 0,85975
TNR : 0,86538
AUC : 0,8529
ROC Curve
Neural Network
Classification by connecting input to output by involving hidden layer and weights
Syntax
cat("
library(caret) AKURASI =",akurasi3,
neural <- train(Severityf~., data=dat6, method="nnet", "
trace = FALSE, preProc = c("center","scale")) PRESISI =",presisi3,
plot(neural) "
RECALL =",recall3,
Confus_Matriks_NN <- predict(neural,test) "
ConMat3<-table(test$Severity, Confus_Matriks_NN) F1 =",F13,
"
print(ConMat3) TPR =", tpr3,
"
akurasi3 <- (sum(diag(ConMat3)))/sum(ConMat3) TNR =", tnr3,
presisi3 <- ConMat3[1,1]/(ConMat3[1,1]+ConMat3[2,1]) "
recall3 <- ConMat3[1,1]/(ConMat3[1,1]+ConMat3[1,2]) AUC =", auc_NN)
F13 <- (2*presisi3*recall3)/(presisi3+recall3)
tpr3<-recall3 #make ROC
tnr3<-ConMat3[2,2]/(ConMat3[2,2]+ConMat3[2,1]) plot(roc(test$Severity, Prediction_NN[,2]))
Neural Network
Akurasi : 0,85625
Presisi : 0,82417
Recall : 0,91463
F1 : 0,86705
TPR : 0,91463
TNR : 0,79487
AUC : 0,93333
ROC Curve