Skip to content

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)

Calls to DecisionTreeEncoder with unseen="encode" where fill_value is omitted or None.

Pass a numeric fill_value to assign unseen categories during transform, or use unseen="ignore" / unseen="raise".

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.