Repository navigation
Conversation
register_spec added every categorical spec to CATEGORICAL_METHODS, so a categorical method registered with preprocessor_compatible=False was still fitted by Preprocessor(categorical_method=...), although the same method in feature_preprocessing was rejected and numerical methods with the flag were excluded from NUMERICAL_METHODS. CATEGORICAL_METHODS is now built from, and extended with, only the categorical specs that are preprocessor compatible. The method stays registered and listed. Fixes #179
This branch has not been deployed
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.
Fixes #179.
A categorical method registered with
preprocessor_compatible=Falsewas still fitted byPreprocessor(categorical_method=...). The same method infeature_preprocessingwas rejected, and numerical methods with the flag were excluded, so the selection paths disagreed.Root cause
register_spec(pretab/compose/registry.py) added every categorical spec toCATEGORICAL_METHODS, the whitelist thatcategorical_method=resolves against. The initial whitelist was built the same way.NUMERICAL_METHODSfilters onspec.preprocessor_compatible.Fix
CATEGORICAL_METHODSholds only categorical specs withpreprocessor_compatible=True.register_specadds a categorical spec to it only when the spec is preprocessor compatible. It still discards the name first, so anoverride=Truere-registration as standalone removes it.TRANSFORMER_REGISTRYand inlist_representations, as numerical standalone methods do.Behaviour changes
Preprocessor(categorical_method=<standalone method>)now raisesInvalidParamError, like the numerical case and thefeature_preprocessingpath. Before, it fitted the method per column.Documentation
register_representationdocstring (preprocessor_compatible): it coversnumerical_method/categorical_methodandfeature_preprocessing, for numerical and categorical methods alike, and the method stays registered and listed.register_specdocstring and the comment onCATEGORICAL_METHODS.Tests
In
tests/extension/test_registration_discovery.py, which restores the registry after each test:test_standalone_categorical_method_is_not_selectable_through_preprocessor(categorical_methodandfeature_preprocessing): the method is registered and listed but not whitelisted, and both selections raise. Fails onmain, passes here.test_overriding_a_categorical_method_as_standalone_removes_it_from_the_whitelist: fails onmain, passes here.test_builtin_categorical_whitelist_holds_only_preprocessor_compatible_methods: guard that passes on both.Reproduction
The script from #179 on this branch:
Checks
just test: 4680 passed, 59 skipped, 7 xfailed; coverage 95.71% (gate 90%).scripts/quickstart.pypasses.just docs: strict build succeeds.just check: all pre-commit and pre-push hooks pass (file hygiene, ruff format, ruff lint, prettier, pyright with 0 errors).Merge notes
main. Git merges this branch cleanly with every open per-issue branch (fix(binning): reject edges the soft encoding cannot use #150 to fix(encoding): number mixed-type categories in the int encoder #178).