daily pastebin goal
34%
SHARE
TWEET

decisionTree

a guest Feb 20th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library(RWeka)
  2. library(caret)
  3. library(e1071)
  4. library(rpart)
  5. DB <- read.csv("/home/onu/Desktop/ML/Imtiaz/data.csv")
  6. DB$class <- as.character(DB$class)
  7. DB$class <- as.factor(DB$class)
  8. DB$ind <- sample(2,nrow(DB),replace=TRUE,prob=c(0.7,0.3))
  9. trainData <- DB[(DB$ind == 1),]
  10. testData <- DB[(DB$ind ==2),]
  11. model <- J48(class~age+gender+tB+dB+alkphos+sgpt+sgot+tP+al.B+aG,data=trainData)
  12. model
  13. head(testData)
  14. x_test <- testData[,1:10]
  15. prediction <- predict(model,x_test)
  16. testData1 <- na.omit(testData)
  17. prediction
  18. confusionMatrix(testData$class,prediction)
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