Should DropHighPSIFeatures count missing values in a separate bin?

オープン
#1,140 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
pandas, python, scikit-learn

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
2.3k
フォーク
391
平均マージ
11時間 34分
マージ済み PR(30日)
11

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

feature-engine/feature_engine のほかの issue

feature-engine/feature_engine の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。