Skip to content

add butcher methods for all int_conform methods - #194

Merged
EmilHvitfeldt merged 2 commits into
mainfrom
butcher
Oct 9, 2025
Merged

add butcher methods for all int_conform methods#194
EmilHvitfeldt merged 2 commits into
mainfrom
butcher

Conversation

@EmilHvitfeldt

Copy link
Copy Markdown
Member

To close #191

Comment thread R/butcher.R

# @export - onLoad
#' @rdname inf_conformal-butcher
axe_call.int_conformal_full <- function(x, verbose = FALSE, ...) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I know that there is a good amount of repetition. However the functions are also really short, so I think that this is the more readable form

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't mind but maybe they should all share a int_conformal class?

@EmilHvitfeldt
EmilHvitfeldt requested a review from hfrick October 8, 2025 22:19

@hfrick hfrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally on board but I'm hoping to learn something about S3 registration details!

Comment thread R/butcher.R

# @export - onLoad
#' @rdname inf_conformal-butcher
axe_call.int_conformal_full <- function(x, verbose = FALSE, ...) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't mind but maybe they should all share a int_conformal class?

Comment thread R/butcher.R
add_butcher_class(x)
}

# @export - onLoad

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the reason for not directly exporting the method? The help page for vctrs::s3_register() says it's for registering an S3 method for a generic from a package you dont' import, just suggest. probably is importing butcher so I'm wondering if we need this extra layer here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm doing it the same way that it was done in {workflows}

https://github.com/tidymodels/workflows/blob/db117b59d8c545a55fd57eeb339ad232616e38a8/R/zzz.R#L6-L10

https://github.com/tidymodels/workflows/blob/db117b59d8c545a55fd57eeb339ad232616e38a8/R/butcher.R#L15

It didn't work when I did it the normal way. So it might be a little out of my depth to understand why.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fairly sure that the reason for this in workflows is because butcher is only in Suggests and not in Imports.

Maybe that affects things here because we make use of the workflows methods, which don't seem to be exported from workflows? 🤔 I'm okay moving on and getting this merged though!

@EmilHvitfeldt

Copy link
Copy Markdown
Member Author

I assume that the reason why there isn't one overall class is that some of the methods have a $flow slot and one of the methods have a $models slot which is a list of workflows.

I do believe it would be worth looking into if there is a way to unify some of the code. But I don't think this PR is the place to do it

@hfrick

hfrick commented Oct 9, 2025

Copy link
Copy Markdown
Member

oh totally agree, the shared class is not a question for this PR!

@EmilHvitfeldt
EmilHvitfeldt merged commit d210d09 into main Oct 9, 2025
13 checks passed
@EmilHvitfeldt
EmilHvitfeldt deleted the butcher branch October 9, 2025 21:46
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.

Add butcher support for probably conformal inference prediction intervals

2 participants