Should DropHighPSIFeatures count missing values in a separate bin?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- pandas, python, scikit-learn
- Domain
- data, machine-learning
Research direction
Read the existing DropHighPSIFeatures implementation and its PSI tests, then trace how missing rows are handled when bin proportions are calculated. Add coverage for the proposed opt-in missing_values="include" behavior, including the example’s rising missing rate. Done when missing values form their own bin using all rows in each period and the default ignore behavior remains intact.
Written by the indexing model from the issue text.
Description
Following up on #883 and #1110. Would you be open to an opt-in missing_values="include" mode in DropHighPSIFeatures?
In this example, A and B are equally frequent among observed rows in both periods, but the missing rate rises from 10% to 50%. Ignoring missing rows gives PSI = 0. Counting them in a separate bin gives PSI ≈ 0.87889.
import pandas as pd
from feature_engine.selection import DropHighPSIFeatures
basis = ["A"] * 9 + ["B"] * 9 + [None] * 2
test = ["A"] * 5 + ["B"] * 5 + [None] * 10
X = pd.DataFrame({"segment": basis + test})
for data in (X, X.fillna("__MISSING__")):
selector = DropHighPSIFeatures(
variables=["segment"], cut_off=19, missing_values="ignore"
).fit(data)
print(float(selector.psi_values_["segment"]))
The second run uses a placeholder category to show the desired result with the existing API. With the proposed option, missing rows would go into their own bin and each period's bin proportions would use all rows.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 391
- Avg merge
- 11h 34m
- Merged PRs (30d)
- 11
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from feature-engine/feature_engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
feature-engine/feature_engine#1141 · 1 comment ·
Maintainers usually reply within 1 day
-
docs
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
feature-engine/feature_engine#393 · 1 comment ·
Maintainers usually reply within 1 day
-
CategoricalImputer fails when fill_value is already a categoryPossibly taken @AryanRG claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 18/100
feature-engine/feature_engine#1113 · 2 comments ·
Maintainers usually reply within 1 day
-
OneHotEncoder loses a dummy name when it matches an encoded input columnPossibly taken @Aadrit555 claimed this 7 days ago. Open
Difficulty 3/5 Half a day Newbie friendliness 25/100
feature-engine/feature_engine#1106 · 1 comment ·
Maintainers usually reply within 1 day
-
DatetimeSubtraction reports dropped reference columns and breaks pandas outputPossibly taken @RugvedBane claimed this 21 days ago. Open
Difficulty 3/5 Half a day Newbie friendliness 22/100
feature-engine/feature_engine#1103 · 5 comments ·
Maintainers usually reply within 1 day
All issues in feature-engine/feature_engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 79/100
developmentseed/titiler-covjson#164 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
awslabs/visual-asset-management-system#2164 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
MakazhanAlpamys/Soup#3589 ·
Maintainers usually reply within 1 day
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketOpen
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day