Skip to content

MissForest ignores declared roles after column-name normalization #525

Closed

Description

@WilliamK112

On current main, explicit simple imputation snake-matches declared target/ID names after column normalization, but the MissForest branch builds contexts that compare those declarations exactly. A custom target declared as Future Sales becomes future_sales, is classified as a numeric feature, and is fitted and filled even though the per-column rule is reported as ignored for the declared target.

Reproduction (with the ML extra installed):

import pandas as pd
import freshdata as fd

frame = pd.DataFrame({
    "Observed Hours": [float(i % 12) for i in range(80)],
    "Future Sales": [10 + 2 * (i % 12) + 0.5 * (i % 5) for i in range(80)],
})
frame.loc[frame.index[::11], "Future Sales"] = float("nan")
cleaned, report = fd.clean(
    frame, strategy="conservative", fix_dtypes=False,
    impute_strategy={"future_sales": "missforest"},
    target_column="Future Sales",
    missforest_n_estimators=10, missforest_max_iter=2,
    return_report=True, verbose=False,
)
print(cleaned["future_sales"].isna().sum())  # actual: 0; expected: 8

Using target_column="future_sales" preserves all eight gaps, as documented in the follow-up to #523. The runtime should apply the same resolved declarations already used by simple imputation to MissForest contexts, preserve declared IDs/targets, and retain the existing audited skip action. I will add regression coverage for global/per-column choices, original/normalized declarations, disabled renaming, and an eligible unprotected feature that still runs a model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions