The Category Encoders pack catches target leakage into test rows, silent misconfiguration, runtime errors on category_encoders 2.11, and removed or deprecated forms on files that import category_encoders. Rules fire only on calls bound to category_encoders imports.
| Rules |
Safe fix |
Unsafe fix |
Manual fix |
| 16 |
1 |
9 |
6 |
| Rule |
Severity |
Fix |
What it finds |
| transform-with-test-target |
error |
unsafe |
Passing the test labels to transform makes a supervised encoder use each test row's own label, which leaks the answer into the features. |
| encode-before-split |
error |
none |
A TargetEncoder fitted on every row before the split puts each test row's own label into its code, which scored 0.655 AUC on data with no signal. |
| Rule |
Severity |
Fix |
What it finds |
| ordinal-mapping-pairs |
error |
unsafe |
An OrdinalEncoder mapping written as a list of pairs matches no category on category_encoders 2.11, so every row is coded -1.0. |
| ordinal-mapping-unknown |
warning |
unsafe |
With a mapping and no handle_unknown, a category the mapping does not name is coded -1 without a warning. |
| zero-regularization |
error |
none |
A regularization or smoothing of 0 codes a category that holds one class alone as inf, without an error. |
| hashing-default-components |
warning |
none |
HashingEncoder hashes every value into 8 columns by default, shared by all encoded columns, so many values collide. |
| cols-left-to-dtype |
info |
unsafe |
A category_encoders encoder without cols encodes only text and category columns, so a numeric column that a ColumnTransformer hands it passes through unchanged. |
| nan-into-pipeline |
warning |
unsafe |
With "return_nan", the encoder hands NaN to the next step of the pipeline, and many models raise on NaN at predict. |
| Rule |
Severity |
Fix |
What it finds |
| supervised-encoder-without-target |
error |
none |
A supervised encoder learns from the target, so fit(X) without it raises. |
| invalid-handle-option |
error |
unsafe |
The encoder does not take this handle_unknown or handle_missing value, so fit raises ValueError on category_encoders 2.10 and later. |
| named-cols-after-array-step |
error |
none |
An encoder that names its cols follows a step that returns a NumPy array, so the names are gone and fit raises ValueError. |
| wrapper-fit-returns-none |
error |
unsafe |
fit of PolynomialWrapper and NestedCVWrapper returns None, so calling a method on its result raises AttributeError. |
| Rule |
Severity |
Fix |
What it finds |
| sklearn-ships-encoder |
info |
none |
scikit-learn ships an encoder of the same name that was 2.7 to 4.5 times faster. |
| Rule |
Severity |
Fix |
What it finds |
| encoder-noise-without-seed |
info |
unsafe |
An encoder that adds random noise draws a new seed on every run, so the codes change from run to run. |