scikit-learn / scikit-learn/scikit-learn

Add Information Value (IV) / Weight-of-Evidence binning as metric and feature-selection

Open
#34,943 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Triage New Feature
Dominant language
Python
Stars
67.3k
Forks
27.4k
Avg merge
1d 15h
Merged PRs (30d)
58

Description

[!WARNING]
This issue is not yet ready for a PR. If you are interested in contributing to scikit-learn, please have a look at our contributing guidelines, and in particular the sections for new contributors and the "Needs triage" label.

Describe the workflow you want to enable

Rank a feature's predictive strength against a binary target by binning it (equal-frequency or optimized) and computing Information Value: sum((pct_event - pct_nonevent) * log(pct_event / pct_nonevent)) over bins.

This is a standard univariate feature-screening step in binary classification, conceptually adjacent to things sklearn already ships in sklearn.feature_selection (mutual_info_classif, f_classif, chi2) as a way to rank/filter features before modeling. Notably this metric does not depends on imbalance.

Describe your proposed solution

'sklearn.metric.IV(X,y, bins=10) would be useful for establishing Information value. Then 'sklearn.feature_selection.information_value(X, y, bins=10)' returning per-feature IV, using equal-frequency quantile binning by default (fast, matches the common textbook definition).

Describe alternatives you've considered, if relevant

Checked scikit-learn's issue tracker for "Information Value" and "Weight of Evidence" - found nothing (no open request, no closed-as-declined). The realistic existing option is optbinning, a purpose-built, actively maintained package that solves actual bin optimization (via a CP/MIP solver) rather than plain quantile cuts.

IV/WOE binning is old and widely used, but specifically within credit-scoring-style binary classification rather than general ML - similar concern to the adjacent PSI request I'm also filing. Raising it mainly to get a maintainer judgment on record, since I couldn't find this discussed anywhere in scikit-learn's history.

Additional context

mutual_info_classif already covers "how predictive is this feature" in a distribution-agnostic way; IV specifically gives interpretable, additive-across-bins output that credit-risk practitioners rely on for regulatory model documentation, which is the main reason it persists as a distinct metric rather than being subsumed by mutual information in that field.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reading the contributing guidelines and the existing sklearn.feature_selection entries for mutual_info_classif, f_classif, and chi2; the issue needs maintainer agreement on scope and API before implementation can be considered done.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.