Should DropHighPSIFeatures count missing values in a separate bin?

Aperta
#1,140 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
pandas, python, scikit-learn

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
2.3k
Fork
391
Merge medio
11h 34m
PR unite (30g)
11

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di feature-engine/feature_engine

Tutte le issue di feature-engine/feature_engine

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.