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

sort ids via vctrs, pass sorting to pull_*() helpers #730

Merged
merged 2 commits into from
Oct 6, 2023
Merged

Conversation

simonpcouch
Copy link
Contributor

Closes #728.

resamples <- pull_notes(resamples, results, control)
resamples <- pull_extracts(resamples, results, control)
resamples <- pull_predictions(resamples, results, control)
# carry out arranging by id before extracting each element of results (#728)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously this sorting happened independently for each of the pull_*() functions that call pulley(). For those that don't call pulley(), the ordering is wrong.

resamples <- pull_extracts(resamples, results, control)
resamples <- pull_predictions(resamples, results, control)
# carry out arranging by id before extracting each element of results (#728)
resample_ids <- grep("^id", names(resamples), value = TRUE)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the pattern used by pulley().

resamples <- pull_predictions(resamples, results, control)
# carry out arranging by id before extracting each element of results (#728)
resample_ids <- grep("^id", names(resamples), value = TRUE)
id_order <- vctrs::vec_order(resamples[resample_ids])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't suspect this is any different than passing those columns to arrange() (some locale technicalities maybe?), but worth looking into.

Copy link
Member

Choose a reason for hiding this comment

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

arrange() uses vec_order_radix() under the hood. but I don't think it should matter much here

@@ -65,22 +71,22 @@ maybe_repair <- function(x) {
}


pull_metrics <- function(resamples, res, control) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The remainder of the changes in this file just newly pass order along to pulley().

resamples <- pull_metrics(resamples, results, control, order = id_order)
resamples <- pull_notes(resamples, results, control, order = id_order)
resamples <- pull_extracts(resamples, results, control, order = id_order)
resamples <- pull_predictions(resamples, results, control, order = id_order)
resamples <- pull_all_outcome_names(resamples, results)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this function doesn't gain an order argument, as its output doesn't end up in tuning results.

@simonpcouch simonpcouch requested review from topepo and EmilHvitfeldt and removed request for topepo September 29, 2023 13:03
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 clean!

R/pull.R Outdated Show resolved Hide resolved
@simonpcouch simonpcouch merged commit 86e3ead into main Oct 6, 2023
9 checks passed
@simonpcouch simonpcouch deleted the fix-728 branch October 6, 2023 14:48
@github-actions
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 21, 2023
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.

entries in .notes don't match the resample id they ought to
2 participants