R/scratch/randomforest.R

library(sumcat)
library(randomForest)
library(party)

str(water_potability)

set.seed(1229)

model <- randomForest(
  formula = as.factor(Potability) ~ .,
  data = water_potability
)

print(model)
print(importance(model,type = 2))

#predict Potability from water_test
predict <- as.integer(predict(model, newdata=water_test[,-10]))-1
samhaycock/sumcat documentation built on Dec. 22, 2021, 10:11 p.m.