Python SDK
Leakage Models
SDK Reference: leakage detection objects
Target leakage occurs when a feature carries information from the future or from the target itself, giving a model an unfair advantage at training time. The review.leakage reviewer runs named pattern detectors against the frozen profile; each detector emits LeakageFinding objects.
LeakageFinding
python
@dataclass(frozen=True, slots=True)class LeakageFinding: pattern: str # detector ID that produced this finding column_name: str title: str rationale: str evidence: Mapping[str, Any] confidence: float # 0.0 to 1.0 severity: str # "info" | "warning" | "critical" suggested_action: strThe Six Built-in Detectors
| Pattern ID | Detector | What It Flags |
|---|---|---|
| target_correlation | Target Correlation | Columns with extreme correlation to the declared target. |
| identifier | Identifier Shape | ID-like columns that also correlate with the target. |
| timestamp | Timestamp Leakage | Datetime columns that extend past a declared prediction cutoff. |
| future_info | Future Information | Columns named like the outcome, or datetime columns extending past a declared event timestamp. |
| duplicate_target | Duplicate Target Information | Columns that are a near-deterministic copy or transform of the target. |
| suspicious_correlation | Suspicious Correlation | Suspicious correlations with a secondary signal, never magnitude alone. |
Detectors run through builtin_detectors() and are supplied to the review.leakage reviewer. Detector findings carry a confidence label: High at or above 0.7, Medium at or above 0.4, and Low below that.
From Detectors to Review Findings
The leakage reviewer merges detector findings into the shared RuleFinding schema so every section speaks the same language:
- One pattern on a column becomes a finding with
rule_id = "leakage.<pattern>". - Several patterns on the same column are merged into a single finding with
rule_id = "leakage.multiple_patterns", keeping the worst severity and the highest confidence. - The original pattern, confidence level, rationale, and suggested action are preserved in the finding's
evidenceandmetadata.