Skip to content

Commit

Permalink
Fixed testing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Jun 26, 2017
1 parent c1aa8fa commit f79fd2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion RegressionTests/Code/evtree.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ testing <- twoClassSim(500, linearVars = 2)
trainX <- training[, -ncol(training)]
trainY <- training$Class

rec_reg <- recipe(Class ~ ., data = training) %>%
rec_cls <- recipe(Class ~ ., data = training) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors())

Expand Down Expand Up @@ -88,6 +88,10 @@ library(plyr)
library(recipes)
library(dplyr)

rec_reg <- recipe(y ~ ., data = training) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors())

airq <- subset(airquality, !is.na(Ozone) & complete.cases(airquality))
trainX <- airq[, -1]
trainY <- airq$Ozone
Expand Down
5 changes: 1 addition & 4 deletions RegressionTests/Code/gcvEarth.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ set.seed(849)
test_class_rec <- train(recipe = rec_cls,
data = training,
method = "gcvEarth",
trControl = cctrl1,
metric = "ROC")
trControl = cctrl1)

test_class_pred_rec <- predict(test_class_rec, testing[, -ncol(testing)])
test_class_prob_rec <- predict(test_class_rec, testing[, -ncol(testing)],
type = "prob")

test_levels <- levels(test_class_cv_model)
if(!all(levels(trainY) %in% test_levels))
Expand Down
3 changes: 3 additions & 0 deletions RegressionTests/Code/msaenet.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ reg_trainX <- reg_training[, -ncol(reg_training)]
reg_testX <- reg_testing[, -ncol(reg_testing)]
reg_trainY <- reg_training$y

rec_reg <- recipe(y ~ ., data = training) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors())

rctrl1 <- trainControl(method = "cv", number = 3, returnResamp = "all")
rctrl2 <- trainControl(method = "LOOCV")
Expand Down

0 comments on commit f79fd2a

Please sign in to comment.