Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- model2_cb<-function(widget, window){
- library(e1071)
- library(caret)
- dialog3 <- gtkFileChooserDialog("Choose the Train File", window, "ok",
- "gtk-cancel", GtkResponseType["cancel"], "gtk-open",
- GtkResponseType["accept"])
- if (dialog3$run() == GtkResponseType["accept"]) {
- df3 <- read.csv(dialog3$getFilename())
- data3<-data.frame(df3)
- dialog3$destroy()
- }
- dialog4 <- gtkFileChooserDialog("Choose the Test FIle", window, "ok",
- "gtk-cancel", GtkResponseType["cancel"], "gtk-open",
- GtkResponseType["accept"])
- if (dialog4$run() == GtkResponseType["accept"]) {
- df4 <- read.csv(dialog4$getFilename())
- data4<-data.frame(df4)
- dialog4$destroy()
- }
- data4$Class <- "Predicted Value"
- combined <- rbind(data3, data4)
- data4 <- combined[combined$Class == "Predicted Value" ,]
- data3 <- combined[combined$Class != "Actual Value" ,]
- svm.model3 <- svm(Class ~ ., data = data3, cost = 1000, gamma = 1)
- svm.pred3 <- predict(svm.model3, newdata = data4)
- table(pred = svm.pred3, true = data4[,7])
- xtab2<-table(pred = svm.pred3, true = data4[,7])
- confusionMatrix(xtab2)
- y1<-confusionMatrix(xtab2)
- cleanoutput2 <- cbind(df4,svm.pred3)
- colnames(cleanoutput2) <- c("IR","MR","FF","CF","CO","CP","Expected Output","Predicted Output")
- print(cleanoutput2)
- print(y1)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement