-
Notifications
You must be signed in to change notification settings - Fork 105
Add quantile regression mode #1209
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
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
e7ce07b
add a quantile regression mode to test with
topepo cbf636f
update type checkers
6bec5cb
avoid confusion with global all_models object
5f6db8c
add quantile_level argument to set_mode()
d753196
initial data for quantreg
5176e86
some initial tests
abcd97d
fix some issues
a153df0
enable quantile prediction
6168556
tests for quantreg
topepo 3bdb471
Quantile predictions output constructor (#1191)
dajmcdon bef131b
quantile regression updates for new hardhat model (#1207)
topepo 861a64a
Change to `quantile` argument to `quantile levels` (#1208)
topepo db551ff
Merge branch 'main' into quantile-mode
topepo 44ebdf7
post conflict merge updates
topepo 481dbc3
update news
topepo 69e754e
version bump and fix typo
topepo 9ebcae0
revert GHA branches
topepo 2fcedb9
small bug fix
58025ca
Apply suggestions from code review
topepo a870db4
don't export median
topepo f5442a7
add call arg
topepo 76d4ff6
Merge branch 'quantile-mode' of https://github.com/tidymodels/parsnip…
topepo 4db8ca6
added documentation on model
topepo 603f47a
add mode
topepo d8cae62
convert error to warning
topepo 07513b6
remove rankdeficient
topepo b8fe3a1
added skip
topepo d88543c
add deprecated `quantile` arg back in
topepo 46fa0db
remove numeric prediction
topepo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| Package: parsnip | ||
| Title: A Common API to Modeling and Analysis Functions | ||
| Version: 1.2.1.9002 | ||
| Version: 1.2.1.9003 | ||
| Authors@R: c( | ||
| person("Max", "Kuhn", , "[email protected]", role = c("aut", "cre")), | ||
| person("Davis", "Vaughan", , "[email protected]", role = "aut"), | ||
|
|
@@ -25,7 +25,7 @@ Imports: | |
| ggplot2, | ||
| globals, | ||
| glue, | ||
| hardhat (>= 1.4.0), | ||
| hardhat (>= 1.4.0.9002), | ||
| lifecycle, | ||
| magrittr, | ||
| pillar, | ||
|
|
@@ -40,8 +40,8 @@ Imports: | |
| vctrs (>= 0.6.0), | ||
| withr | ||
| Suggests: | ||
| C50, | ||
| bench, | ||
| C50, | ||
| covr, | ||
| dials (>= 1.1.0), | ||
| earth, | ||
|
|
@@ -69,16 +69,17 @@ Suggests: | |
| xgboost (>= 1.5.0.1) | ||
| VignetteBuilder: | ||
| knitr | ||
| Remotes: | ||
| r-lib/sparsevctrs, | ||
| tidymodels/hardhat | ||
| ByteCompile: true | ||
| Config/Needs/website: C50, dbarts, earth, glmnet, keras, kernlab, kknn, | ||
| LiblineaR, mgcv, nnet, parsnip, randomForest, ranger, rpart, rstanarm, | ||
| tidymodels/tidymodels, tidyverse/tidytemplate, rstudio/reticulate, | ||
| LiblineaR, mgcv, nnet, parsnip, quantreg, randomForest, ranger, rpart, | ||
| rstanarm, tidymodels/tidymodels, tidyverse/tidytemplate, rstudio/reticulate, | ||
| xgboost | ||
| Config/rcmdcheck/ignore-inconsequential-notes: true | ||
| Config/testthat/edition: 3 | ||
| Encoding: UTF-8 | ||
| LazyData: true | ||
| Roxygen: list(markdown = TRUE) | ||
| Remotes: | ||
| r-lib/sparsevctrs | ||
| RoxygenNote: 7.3.2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #' Reformat quantile predictions | ||
| #' | ||
| #' @param x A matrix of predictions with rows as samples and columns as quantile | ||
| #' levels. | ||
| #' @param object A parsnip `model_fit` object from a quantile regression model. | ||
| #' @keywords internal | ||
| #' @export | ||
| matrix_to_quantile_pred <- function(x, object) { | ||
topepo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (!is.matrix(x)) { | ||
| x <- as.matrix(x) | ||
| } | ||
| rownames(x) <- NULL | ||
| n_pred_quantiles <- ncol(x) | ||
| quantile_levels <- object$spec$quantile_levels | ||
|
|
||
| tibble::new_tibble(x = list(.pred_quantile = hardhat::quantile_pred(x, quantile_levels))) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #' Linear quantile regression via the quantreg package | ||
| #' | ||
| #' [quantreg::rq()] optimizes quantile loss to fit models with numeric outcomes. | ||
| #' | ||
| #' @includeRmd man/rmd/linear_reg_quantreg.md details | ||
| #' | ||
| #' @name details_linear_reg_quantreg | ||
| #' @keywords internal | ||
| NULL | ||
|
|
||
| # See inst/README-DOCS.md for a description of how these files are processed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.