feature_engine/decision-tree-encoder-unseen-no-fill
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| Feature-engine | error | none, edit by hand | All versions |
DecisionTreeEncoder raises ValueError("When unseen='encode' you need to pass a number to fill_value.") whenever unseen="encode" is set without a numeric fill_value.
enc = DecisionTreeEncoder(unseen="encode")enc = DecisionTreeEncoder(unseen="encode", fill_value=0.0)What the rule reports
Section titled “What the rule reports”Calls to DecisionTreeEncoder with unseen="encode" where fill_value is omitted or None.
How to fix it
Section titled “How to fix it”Pass a numeric fill_value to assign unseen categories during transform, or use unseen="ignore" / unseen="raise".
Diagnostic message
Section titled “Diagnostic message”DecisionTreeEncoder(unseen='encode') requires a numeric fill_value= and raises ValueError when fill_value is None. Pass a numeric fill_value= or set unseen='ignore'.See all rules in the Feature-engine pack.