Back to Practice
#0078

Detect Suspicious Leakage Columns

EasyML15 min15 XP

Problem

Given feature column names and target column name, return names that look suspicious. A feature is suspicious if it equals the target, contains the target text, or contains "future", "after", or "post". Compare case-insensitively.

Why This Matters

Leakage can make a model look brilliant offline and fail instantly in production. Naming checks are not enough, but they are a useful first audit.

Function Signature

def leakage_columns(features, target):

Examples

Example 1
Inputfeatures = ["age", "churn_after_30d", "plan"], target = "churn"
Output["churn_after_30d"]

The feature appears to use future churn information.

Constraints

  • Preserve original feature names in the output.
  • Preserve input order.
  • This is a naming audit, not proof of leakage.
CodePython
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Target and future words
Input["age","churn_after_30d","post_score","plan"], "churn"
Expected["churn_after_30d","post_score"]

Both names look suspicious.

Hidden Test Categories
case-insensitive matchexact target columnno suspicious columns