Skip to content
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

Add quantile regression mode #1209

Merged
merged 29 commits into from
Oct 11, 2024
Merged

Add quantile regression mode #1209

merged 29 commits into from
Oct 11, 2024

Conversation

topepo
Copy link
Member

@topepo topepo commented Sep 26, 2024

Culmination of #1191, #1207, and #1208.

cc @dajmcdon

  • Adds the new mode.
  • Allows users to set quantile levels in set_mode().
  • Changes the argument to predict_quantile() from quantile to quantile_levels
  • Removes quantile prediction methods for deprecated surv_reg() model.
  • Infrastructure to use the new vctrs object for quantile predictions.
  • Adds a "quantreg" engine to linear_reg().

topepo and others added 17 commits August 5, 2024 10:46
* small change to predict checks

* add vctrs for quantiles and test, refactor *_rq_preds

* revise tests

* Apply some of the suggestions from code review

Co-authored-by: Simon P. Couch <[email protected]>

* rename tests on suggestion from code review

* export missing funs from vctrs for formatting

* convert errors to snapshot tests

* pass call through input check

* update snapshots for caller_env

* rename to parsnip_quantiles, add format snapshot tests

* Apply suggestions from @topepo

Co-authored-by: Max Kuhn <[email protected]>

* rename parsnip_quantiles to quantile_pred

* rename parsnip_quantiles to quantile_pred and add vector probability check

* fix: two bugs introduced earlier

* add formatting tests for single quantile

* replace walk with a loop to avoid "Error in map()"

* remove row/col names

* adjust quantile_pred format

* as_tibble method

* updated NEWS file

* add PR number

* small new update

* helper methods

* update docs

* re-enable quantiles prediction for #1203

* update some tests

* no longer needed

* use tibble::new_tibble

* braces

* test as_tibble

* remove print methods

---------

Co-authored-by: Simon P. Couch <[email protected]>
Co-authored-by: Max Kuhn <[email protected]>
Co-authored-by: ‘topepo’ <‘[email protected]’>
* bump hardhat version

* remove parts now in hardhat

* update for new hardhat version

* quantile_levels (plural now)

* news update

* typo

* rename helper function

* run CI on PRs from branches

* forgotten remote

* actions for edited PRs

* plural

* expand branch list

* export function for censored to use

* updated snapshot

* remake snapshot

* Revert "remake snapshot"

This reverts commit 954e326.

* updated snapshot

* Update R/arguments.R

Co-authored-by: Hannah Frick <[email protected]>

* typo

* changes from reviewer feedback

---------

Co-authored-by: ‘topepo’ <‘[email protected]’>
Co-authored-by: Hannah Frick <[email protected]>
* quantile -> quantile_levels for #1203

* defer test until censored updates in new PR

* update docs for quantile_levels

* update test

* disable quantile predictions for surv_reg

---------

Co-authored-by: ‘topepo’ <‘[email protected]’>
@topepo topepo marked this pull request as ready for review September 27, 2024 00:03
@dajmcdon
Copy link
Contributor

Thanks for all your work on this @topepo and others!

If I were to make additional engines, would you like them in PRs here, or just elsewhere for now?

@topepo
Copy link
Member Author

topepo commented Sep 30, 2024

If I were to make additional engines, would you like them in PRs here, or just elsewhere for now?

If we can avoid wrapper and more imports, then go ahead and put them here. Were you thinking of making another package to house new methods?

Copy link
Member

@hfrick hfrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good so far. I'm having second thoughts on the name swap for the quantiles/quantile_levels argument: I'd be in favor of deprecating that argument rather than changing it without warning.

Since you are not only adding a new mode but also a new engine with it, could you go over the checklists in https://github.com/tidymodels/tidymodels/pull/97/files? I think the PR is still missing the updates to the model registry, docs, examples, etc.

NEWS.md Outdated Show resolved Hide resolved
R/aaa-import-standalone-types-check.R Outdated Show resolved Hide resolved
R/aaa_models.R Outdated Show resolved Hide resolved
R/aaa_quantiles.R Show resolved Hide resolved
R/arguments.R Show resolved Hide resolved
R/predict_quantile.R Outdated Show resolved Hide resolved
tests/testthat/_snaps/registration.md Outdated Show resolved Hide resolved
tests/testthat/test-surv_reg_survreg.R Show resolved Hide resolved
tests/testthat/test-linear_reg_quantreg.R Outdated Show resolved Hide resolved
R/predict.R Outdated Show resolved Hide resolved
Copy link
Member

@EmilHvitfeldt EmilHvitfeldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good so far! left some suggested changes and questions

R/aaa_models.R Show resolved Hide resolved
R/arguments.R Outdated Show resolved Hide resolved
R/parsnip-package.R Outdated Show resolved Hide resolved
R/linear_reg_data.R Outdated Show resolved Hide resolved
R/predict_quantile.R Outdated Show resolved Hide resolved
R/predict_quantile.R Outdated Show resolved Hide resolved
R/predict_quantile.R Show resolved Hide resolved
R/print.R Outdated Show resolved Hide resolved
@topepo topepo merged commit 297320e into main Oct 11, 2024
10 checks passed
@topepo topepo deleted the quantile-mode branch October 11, 2024 11:14
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants