Code Room
Code reviewMediumcr-g622
Subject Ml target leakageLevel Mid–Senior~18 minCommon in ML systems interviewsIndustries Software development

Question

Review this Python feature-engineering step for a churn model.

The model hits 0.99 AUC on a proper held-out split. Why is that a red flag?

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
import pandas as pd def build_features(df: pd.DataFrame) -> pd.DataFrame:    # df has: customer_id, monthly_spend, tenure, churned (0/1)    df = df.copy()    df["spend_per_tenure"] = df["monthly_spend"] / (df["tenure"] + 1)    # operations team flags churners for a retention call    df["got_retention_call"] = df["churned"]  # 1 if they were called    df["high_value"] = (df["monthly_spend"] > 200).astype(int)    feature_cols = ["spend_per_tenure", "got_retention_call", "high_value"]    return df[feature_cols], df["churned"]
Run or narrate your approach, then ask the coach.