-
Notifications
You must be signed in to change notification settings - Fork 8
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
improve error messages #80
base: main
Are you sure you want to change the base?
Changes from all commits
cffbbb7
13e5271
9286cb5
8033a80
447a64b
26f42e5
c9c5fd4
24da0d1
c84ec5f
2df9901
1adc406
f90631c
5e45004
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ Version: 1.0.2.9000 | |
Authors@R: c( | ||
person("Max", "Kuhn", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0003-2402-136X")), | ||
person(given = "Posit Software, PBC", role = c("cph", "fnd")) | ||
person("Posit Software, PBC", role = c("cph", "fnd")) | ||
) | ||
Description: Tree- and rule-based models can be bagged | ||
(<doi:10.1007/BF00058655>) using this package and their predictions | ||
|
@@ -28,17 +28,16 @@ Imports: | |
hardhat (>= 1.1.0), | ||
magrittr, | ||
purrr, | ||
rlang, | ||
rlang (>= 1.1.0), | ||
rpart, | ||
rsample, | ||
tibble, | ||
tidyr, | ||
utils, | ||
withr | ||
Suggests: | ||
AmesHousing, | ||
covr, | ||
earth, | ||
earth, | ||
modeldata, | ||
nnet, | ||
recipes, | ||
|
@@ -48,7 +47,31 @@ Suggests: | |
yardstick | ||
Config/Needs/website: tidyverse/tidytemplate | ||
Config/testthat/edition: 3 | ||
Config/usethis/last-upkeep: 2024-10-23 | ||
Encoding: UTF-8 | ||
Language: en-US | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.2 | ||
Collate: | ||
'C5.0.R' | ||
'bag_mars_data.R' | ||
'bag_nnet_data.R' | ||
'bag_tree_data.R' | ||
'import-standalone-types-check.R' | ||
'validate.R' | ||
'bagger.R' | ||
'baguette-package.R' | ||
'bridge.R' | ||
'cart.R' | ||
'class_cost.R' | ||
'constructor.R' | ||
'cost_models.R' | ||
'import-standalone-obj-type.R' | ||
'mars.R' | ||
'misc.R' | ||
'model_info.R' | ||
'nnet.R' | ||
'out-of-bag.R' | ||
'predict.R' | ||
'var_imp.R' | ||
'zzz.R' |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
#' @param times A single integer greater than 1 for the maximum number of bootstrap | ||
#' samples/ensemble members (some model fits might fail). | ||
#' @param control A list of options generated by `control_bag()`. | ||
#' @param cost A non-negative scale (for two class problems) or a cost matrix. | ||
#' @param cost A non-negative scale (for two class problems) or a square cost matrix. | ||
#' @param ... Optional arguments to pass to the base model function. | ||
#' @details `bagger()` fits separate models to bootstrap samples. The | ||
#' prediction function for each model object is encoded in an R expression and | ||
|
@@ -89,6 +89,7 @@ | |
#' cart_pca_bag | ||
#' } | ||
#' @export | ||
#' @include validate.R | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DOWN WITH aaa FILES |
||
bagger <- function(x, ...) { | ||
UseMethod("bagger") | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
new_bagger <- function(model_df, imp, control, cost, base_model, blueprint) { | ||
new_bagger <- function(model_df, imp, control, cost, base_model, blueprint, | ||
call = rlang::caller_env()) { | ||
|
||
if (!is_tibble(model_df)) { | ||
cli::cli_abort("`model_df` should be a tibble.") | ||
cli::cli_abort("{.arg model_df} should be {.cls tibble}.", call = call) | ||
} | ||
|
||
# TODO extend to use mode from model object(s) | ||
if (is.numeric(blueprint$ptypes$outcomes[[1]])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could eventually extend baguette to censored regression models. There is a lot of code that looks at the data to get the mode or assumes that they are either regression or classification. |
||
mod_mode <- "regression" | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm going to assume that this is leftover from a long time ago, and that we don't need it since we have modeldata