Skip to content

Allow for already-instantiated resampler to be passed to cpi() function#22

Open
mikoontz wants to merge 2 commits intobips-hb:masterfrom
mikoontz:resampling-fix
Open

Allow for already-instantiated resampler to be passed to cpi() function#22
mikoontz wants to merge 2 commits intobips-hb:masterfrom
mikoontz:resampling-fix

Conversation

@mikoontz
Copy link
Copy Markdown

The cpi() function allows for custom resamplers to be passed to it. As written, the function automatically instantiates that resampler with no additional arguments, regardless of whether it has already been instantiated. However, calling $instantiate can break with some resamplers since they might require additional parameters to be passed. This patch allows an already instantiated resampler to be passed to the cpi function instead. It uses the is_instantiated functionality to check if the resampler has already been instantiated. In that case, it does not try to instantiate. In other cases, the cpi() function will try what it has done before-- to instantiate the resampler with no arguments.

This arose when I was trying to use a "custom_cv" resampler (rsmp("custom_cv")) which requires an additional argument f to specify membership of each row in a factor level.

mikoontz and others added 2 commits August 30, 2024 16:30
…require additional parameters to be passed. This patch allows an already instantiated resampler to be passed to the cpi function instead.
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.

1 participant