Last active
January 6, 2020 01:36
-
-
Save adammb86/537bf60996e4758556a5f2d1b2f77d1d to your computer and use it in GitHub Desktop.
Ujicoba Naive Baye menggunakan R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tingkat Perekonomian | Jenis Kelamin | Pekerjaan | Punya Deposito? | |
---|---|---|---|---|
Menengah Ke Atas | Pria | Tetap | Ya | |
Menengah Ke Atas | Pria | Tetap | Tidak | |
Menengah Ke Atas | Pria | Tetap | Ya | |
Menengah Ke Bawah | Pria | Tetap | Tidak | |
Menengah Ke Bawah | Pria | Honorer | Ya | |
Menengah Ke Bawah | Wanita | Honorer | Tidak | |
Menengah Ke Bawah | Wanita | Honorer | Ya | |
Menengah Ke Bawah | Wanita | Tetap | Tidak | |
Menengah Ke Atas | Wanita | Honorer | Tidak | |
Menengah Ke Atas | Pria | Honorer | Ya |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TingkatPerekonomian | JenisKelamin | Pekerjaan | PunyaDeposito | |
---|---|---|---|---|
Menengah Ke Atas | Pria | Tetap | ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
install.packages('e1071') | |
library("e1071") | |
data<-read.csv(file.choose(),header = TRUE) #CSV 10 record pertama | |
data<-as.data.frame(data) | |
# | |
nama<-nama<-c("TingkatPerekonomian","JenisKelamin","Pekerjaan","PunyaDeposito") | |
names(data)<-nama | |
# | |
names(data)<- c("TingkatPerekonomian","JenisKelamin","Pekerjaan","PunyaDeposito") | |
# | |
View(data) | |
# | |
model<-naiveBayes(PunyaDeposito ~ ., data= data) #CSV 1 record terakhir | |
model | |
# | |
datauji<-read.csv(file.choose(),header = TRUE) | |
predict(model,as.data.frame(datauji)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment