daily pastebin goal
18%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SATimage = read.table(file.choose(), header = T, sep = ",")
  2. SATimage = data.frame(class = as.factor(SATimage$class), SATimage[,1:36])
  3.  
  4. set.seed(888)
  5. testcases = sample(1:dim(SATimage)[1],1000,replace=F)
  6. SATtest = SATimage[testcases,]
  7. SATtrain = SATimage[-testcases,]
  8.  
  9. library(rpart)
  10. SI.rpart = rpart(class~., data = SATimage)
  11. SI.rpart
  12.  
  13. library(ipred)
  14. SI.bag = bagging(class~.,data = SATtrain,SATtrain$class, coob = T)
  15. SI.bag
  16. ybag = predict(SI.bag, newdata = SATtest)
  17. SI.bagMis = misclass(ybag,SATtest$class)
  18.  
  19. library(randomForest)
  20. SI.rf = randomForest(class~.,data = SATtrain, mtry = 2, importance = T)
  21. yfor = predict(SI.rf, newdata = SATtest)
  22. SI.rfMis = misclass(yfor, SATtest$class)
  23. SI.rfMis
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top