EX-28: Point-in-Time 'As-Of' Joins (Zero Target Leakage)
Track: AI Readiness & EU AI Act • Difficulty: Intermediate • Mastery Points: 150 PTS
Business Problem Scenario
Global DynaDatum Bank's automated Retail Credit Risk AI scoring model was flagged during a regulatory audit for future feature leakage: feature debit_volume_90d inadvertently aggregated transactions that occurred after the customer's loan application decision date. Under EU AI Act Article 10 (Data and Data Governance guidelines for high-risk AI), datasets must enforce strict point-in-time fidelity to prevent lookahead bias. For strict production point-in-time correctness, timestamp boundaries must cut off transactions at or before decision time.
Engineering Objective
Write a point-in-time feature aggregation query joining silver.credit_applications a through silver.core_accounts acc to silver.core_transactions t. • Expected Columns: a.application_id, a.customer_id, a.decision_date, coalesce(sum(t.amount), 0.00) AS debit_volume_90d • Temporal Boundary: Join on a.customer_id = acc.customer_id AND acc.account_id = t.account_id AND t.txn_date BETWEEN a.decision_date - INTERVAL 90 DAYS AND a.decision_date. Group by a.application_id, a.customer_id, a.decision_date. Key Concepts: - Target Leakage: Feature contamination introducing post-decision observations into historical model training data. - EU AI Act Article 10: Regulatory guidance ensuring high-risk AI training data is temporally sound, relevant, and representative.
Target Table: silver.credit_applications a (application_id STRING, customer_id STRING, decision_date DATE), silver.core_accounts acc (account_id STRING, customer_id STRING), silver.core_transactions t (txn_id STRING, account_id STRING, txn_date DATE, amount DECIMAL(18,2))
Verification & Architecture Insights
Strict as-of temporal boundaries eliminate target leakage, preventing production ML models from cheating during offline backtests.