Skip to content

use modeldata package and data treatment in predict #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ Suggests:
ranger,
rpart,
MASS,
nlme
nlme,
modeldata
105 changes: 0 additions & 105 deletions R/data.R

This file was deleted.

1 change: 1 addition & 0 deletions R/descriptors.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#'
#' \preformatted{
#'
#' library(modeldata)
#' data("lending_club")
#'
#' rand_forest(mode = "classification", mtry = .cols() - 2)
Expand Down
1 change: 1 addition & 0 deletions R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#' # methods for specifying the model can be used
#'
#' library(dplyr)
#' library(modeldata)
#' data("lending_club")
#'
#' lr_mod <- logistic_reg()
Expand Down
9 changes: 7 additions & 2 deletions R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ prepare_data <- function(object, new_data) {
new_data <- convert_form_to_xy_new(object$preproc, new_data)$x
}
}

new_data
switch(
fit_interface,
none = new_data,
data.frame = as.data.frame(new_data),
matrix = as.matrix(new_data),
new_data
)
}

Binary file removed data/check_times.rda
Binary file not shown.
3 changes: 0 additions & 3 deletions data/datalist

This file was deleted.

Binary file removed data/lending_club.rda
Binary file not shown.
Binary file removed data/wa_churn.rda
Binary file not shown.
64 changes: 0 additions & 64 deletions man/check_times.Rd

This file was deleted.

1 change: 1 addition & 0 deletions man/descriptors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/fit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions man/lending_club.Rd

This file was deleted.

29 changes: 0 additions & 29 deletions man/wa_churn.Rd

This file was deleted.

7 changes: 7 additions & 0 deletions tests/testthat/helper-objects.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
library(modeldata)

data("wa_churn")
data("lending_club")

# ------------------------------------------------------------------------------

ctrl <- control_parsnip(verbosity = 1, catch = FALSE)
caught_ctrl <- control_parsnip(verbosity = 1, catch = TRUE)
quiet_ctrl <- control_parsnip(verbosity = 0, catch = TRUE)
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_boost_tree_C50.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ library(dplyr)
context("boosted tree execution with C5.0")
source("helper-objects.R")

data("lending_club")
lending_club <- head(lending_club, 200)
lending_club_fail <-
lending_club %>%
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test_failed_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ iris_bad <-
iris %>%
mutate(big_num = Inf)

data("lending_club")

lending_club <-
lending_club %>%
dplyr::slice(1:200) %>%
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_logistic_reg.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ test_that('bad input', {

# ------------------------------------------------------------------------------

data("lending_club")
lending_club <- head(lending_club, 200)
lc_form <- as.formula(Class ~ log(funded_amnt) + int_rate)
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_logistic_reg_glmnet.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ library(tidyr)
context("logistic regression execution with glmnet")
source("helper-objects.R")

data("lending_club")
lending_club <- head(lending_club, 200)
lc_form <- as.formula(Class ~ log(funded_amnt) + int_rate)
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_logistic_reg_keras.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ source("helpers.R")

# ------------------------------------------------------------------------------

data("lending_club")
set.seed(352)
dat <-
lending_club %>%
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_logistic_reg_stan.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ library(tibble)
context("execution tests for stan logistic regression")
source("helper-objects.R")

data("lending_club")
lending_club <- head(lending_club, 200)
lc_form <- as.formula(Class ~ log(funded_amnt) + int_rate)
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test_mars.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ test_that('submodel prediction', {

# ------------------------------------------------------------------------------

data("lending_club")

test_that('classification', {
skip_if_not_installed("earth")

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_rand_forest_randomForest.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ source("helper-objects.R")

# ------------------------------------------------------------------------------

data("lending_club")
lending_club <- head(lending_club, 200)
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_rand_forest_ranger.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ source("helper-objects.R")

# ------------------------------------------------------------------------------

data("lending_club")
lending_club <- head(lending_club, 200)
num_pred <- c("funded_amnt", "annual_inc", "num_il_tl")

Expand Down