Last active
January 7, 2019 03:31
-
-
Save svanderbleek/5b2ea104751c7215f4fa25590104ff7d to your computer and use it in GitHub Desktop.
bank
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
library(caret) | |
library(dplyr) | |
data = read.csv2("bank-additional-full.csv") | |
f = y ~ duration + pdays + euribor3m + month + day_of_week + job + default + age + previous + contact + poutcome + nr.employed + cons.price.idx | |
# Scaling Parameters | |
SAMPLE = 10 | |
TREES = 100 | |
TUNE = 1 | |
# Stratified Sampling by y | |
sample = data %>% group_by(y) %>% sample_n(SAMPLE) %>% ungroup | |
rf = train(f, data = sample, method = "rf", ntrees = TREES, trControl = trainControl(method = "LOOCV", verboseIter = TRUE), verbose = TRUE) | |
knn = train(f, data = sample, method = "knn", tuneLength = TUNE, trControl = trainControl(method = "LOOCV", verboseIter = TRUE)) | |
# Timing Example | |
system.time(train(f, data = sample, method = "rf", trControl = trainControl(method = "LOOCV"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment