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

use hardhat::quantile_pred #332

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

use hardhat::quantile_pred #332

wants to merge 8 commits into from

Conversation

topepo
Copy link
Member

@topepo topepo commented Sep 30, 2024

Changes for tidymodels/parsnip#1203 to convert quantile predictions to the new vctrs class.

@topepo
Copy link
Member Author

topepo commented Oct 11, 2024

💢

  * pec: Can't install dependency rms (>= 4.2-0)
  * rms: Needs R >= 4.4.0

@topepo topepo marked this pull request as ready for review October 11, 2024 12:35
@topepo topepo requested a review from hfrick October 15, 2024 11:55
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.

Looks good!

Comment on lines +50 to +51
possible_cols <- c(".pred_quantile", ".pred_lower", ".pred_upper")
existing_cols <- intersect(possible_cols, nms)
Copy link
Member

Choose a reason for hiding this comment

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

nice naming, it's easy to read!

}

re_nest <- function(df) {
.row <- 1:nrow(df)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.row <- 1:nrow(df)
.row <- seq_len(nrow(df))

Comment on lines -243 to -246
expect_equal(
tidyr::unnest(pred, cols = .pred)$.pred_quantile,
do.call(rbind, exp_pred)$est
)
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep the check on the values here, like we did for the flexsurv engine? I don't mind if the checks on the confidence intervals below only check the structure.

# column with co.lumns ".quantile" and ".pred_quantile" and perhaps
# ".pred_lower" and ".pred_upper"

flexsurv_to_quantile_pred <- function(x, object) {
Copy link
Member

Choose a reason for hiding this comment

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

There is already another function to use in the post hook of the prediction module, called flexsurv_post(). Can we call this one flexsurv_post_quantile()?

df
}

nested_df_iter <- function(df, col) {
Copy link
Member

Choose a reason for hiding this comment

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

How about col_to_quantile_pred() as a name?

@@ -57,7 +57,7 @@ jobs:
extra-packages:
any::rcmdcheck,
aorsf=?ignore-before-r=4.2.0,
pec=?ignore-before-r=4.3.0
pec=?ignore-before-r=4.4.0
Copy link
Member Author

Choose a reason for hiding this comment

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

👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants