Skip to content

Commit

Permalink
Fixed testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Jun 26, 2017
1 parent a09cab3 commit 5472577
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions RegressionTests/Code/evtree.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,17 @@ 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
testX <- airq[, -1]
testY <- airq$Ozone

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

rctrl1 <- trainControl(method = "cv", number = 3, returnResamp = "all")
rctrl2 <- trainControl(method = "LOOCV")
rctrl3 <- trainControl(method = "none")
Expand Down
6 changes: 3 additions & 3 deletions RegressionTests/Code/msaenet.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ 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) %>%
rec_reg <- recipe(y ~ ., data = reg_training) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors())

Expand Down Expand Up @@ -132,11 +132,11 @@ test_reg_none_pred <- predict(test_reg_none_model, reg_trainX)

set.seed(849)
test_reg_rec <- train(recipe = rec_reg,
data = training,
data = reg_training,
method = "msaenet",
trControl = rctrl1)

test_reg_pred_rec <- predict(test_reg_rec, testing[, -ncol(testing)])
test_reg_pred_rec <- predict(test_reg_rec, reg_testing[, -ncol(reg_testing)])

#########################################################################

Expand Down

0 comments on commit 5472577

Please sign in to comment.