Feature: Custom encoders returning multiple components#3069
Merged
dennisbader merged 12 commits intoMay 29, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3069 +/- ##
==========================================
+ Coverage 96.47% 96.48% +0.01%
==========================================
Files 160 160
Lines 17262 17285 +23
==========================================
+ Hits 16654 16678 +24
+ Misses 608 607 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cd20aec to
1ab9431
Compare
dennisbader
approved these changes
May 29, 2026
Collaborator
dennisbader
left a comment
There was a problem hiding this comment.
Beautiful PR, thanks a lot @mwaldleben 🚀
I just pushed some minor changes that are unrelated to your PR (we're removing the raise_if* helpers slowly so I took the chance to do it for the encoders module in this PR).
I'll merge once all tests have passed 💯
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist before merging this PR:
Fixes #2806.
Summary
This PR adds support in
CallableIndexEncoderfor custom encoders to return multiple components. A single callable used viaadd_encoders["custom"]can now return either a 1D array of shape(len(index),)or a 2D array of shape(len(index), n).For a 2D output, one encoded covariate component per column are created. The number of components is detected at initialization time. If the callable does not accept a supported index type or does not return the correct output shape, a
ValueErroris raised at initialization.