Skip to content

Commit 2e5d3fa

Browse files
authored
Merge pull request #247 from tidymodels/devel
use modeldata package and data treatment in predict
2 parents 1c2612a + a7c3cb7 commit 2e5d3fa

24 files changed

+20
-244
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ Suggests:
4949
ranger,
5050
rpart,
5151
MASS,
52-
nlme
52+
nlme,
53+
modeldata

R/data.R

Lines changed: 0 additions & 105 deletions
This file was deleted.

R/descriptors.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#'
5959
#' \preformatted{
6060
#'
61+
#' library(modeldata)
6162
#' data("lending_club")
6263
#'
6364
#' rand_forest(mode = "classification", mtry = .cols() - 2)

R/fit.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#' # methods for specifying the model can be used
4949
#'
5050
#' library(dplyr)
51+
#' library(modeldata)
5152
#' data("lending_club")
5253
#'
5354
#' lr_mod <- logistic_reg()

R/predict.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,12 @@ prepare_data <- function(object, new_data) {
229229
new_data <- convert_form_to_xy_new(object$preproc, new_data)$x
230230
}
231231
}
232-
233-
new_data
232+
switch(
233+
fit_interface,
234+
none = new_data,
235+
data.frame = as.data.frame(new_data),
236+
matrix = as.matrix(new_data),
237+
new_data
238+
)
234239
}
235240

data/check_times.rda

-355 KB
Binary file not shown.

data/datalist

Lines changed: 0 additions & 3 deletions
This file was deleted.

data/lending_club.rda

-150 KB
Binary file not shown.

data/wa_churn.rda

-89.7 KB
Binary file not shown.

man/check_times.Rd

Lines changed: 0 additions & 64 deletions
This file was deleted.

man/descriptors.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/fit.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/lending_club.Rd

Lines changed: 0 additions & 29 deletions
This file was deleted.

man/wa_churn.Rd

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/testthat/helper-objects.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
library(modeldata)
2+
3+
data("wa_churn")
4+
data("lending_club")
5+
6+
# ------------------------------------------------------------------------------
7+
18
ctrl <- control_parsnip(verbosity = 1, catch = FALSE)
29
caught_ctrl <- control_parsnip(verbosity = 1, catch = TRUE)
310
quiet_ctrl <- control_parsnip(verbosity = 0, catch = TRUE)

tests/testthat/test_boost_tree_C50.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ library(dplyr)
88
context("boosted tree execution with C5.0")
99
source("helper-objects.R")
1010

11-
data("lending_club")
1211
lending_club <- head(lending_club, 200)
1312
lending_club_fail <-
1413
lending_club %>%

tests/testthat/test_failed_models.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ iris_bad <-
1313
iris %>%
1414
mutate(big_num = Inf)
1515

16-
data("lending_club")
17-
1816
lending_club <-
1917
lending_club %>%
2018
dplyr::slice(1:200) %>%

tests/testthat/test_logistic_reg.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ test_that('bad input', {
215215

216216
# ------------------------------------------------------------------------------
217217

218-
data("lending_club")
219218
lending_club <- head(lending_club, 200)
220219
lc_form <- as.formula(Class ~ log(funded_amnt) + int_rate)
221220
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")

tests/testthat/test_logistic_reg_glmnet.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ library(tidyr)
99
context("logistic regression execution with glmnet")
1010
source("helper-objects.R")
1111

12-
data("lending_club")
1312
lending_club <- head(lending_club, 200)
1413
lc_form <- as.formula(Class ~ log(funded_amnt) + int_rate)
1514
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")

tests/testthat/test_logistic_reg_keras.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ source("helpers.R")
1111

1212
# ------------------------------------------------------------------------------
1313

14-
data("lending_club")
1514
set.seed(352)
1615
dat <-
1716
lending_club %>%

tests/testthat/test_logistic_reg_stan.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ library(tibble)
88
context("execution tests for stan logistic regression")
99
source("helper-objects.R")
1010

11-
data("lending_club")
1211
lending_club <- head(lending_club, 200)
1312
lc_form <- as.formula(Class ~ log(funded_amnt) + int_rate)
1413
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")

tests/testthat/test_mars.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ test_that('submodel prediction', {
285285

286286
# ------------------------------------------------------------------------------
287287

288-
data("lending_club")
289-
290288
test_that('classification', {
291289
skip_if_not_installed("earth")
292290

tests/testthat/test_rand_forest_randomForest.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ source("helper-objects.R")
99

1010
# ------------------------------------------------------------------------------
1111

12-
data("lending_club")
1312
lending_club <- head(lending_club, 200)
1413
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")
1514

tests/testthat/test_rand_forest_ranger.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ source("helper-objects.R")
1010

1111
# ------------------------------------------------------------------------------
1212

13-
data("lending_club")
1413
lending_club <- head(lending_club, 200)
1514
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")
1615

0 commit comments

Comments
 (0)