Credit-risk data engineering

Point-in-time snapshots and performance labels

Separate feature availability from future outcomes to prevent look-ahead leakage.

Visual summary of Point-in-time snapshots and performance labels: Separate feature availability from future outcomes to prevent look-ahead leakage.
A visual overview of Separate feature availability from future outcomes to prevent look-ahead leakage. See the guide for assumptions and implementation details.

Purpose

Build an as-of dataset where predictors precede a defined outcome window.

Hover over or focus a term for a quick definition, or open its glossary entry.

  • Censoring
  • Default

Key definitions

  • A point-in-time snapshot contains values known as of a specified observation date.
  • A performance label records an event or outcome in a later defined window.
Formula
Feature timestamp ≤ observation date < target-window start/end; label uses only events after the observation date.

Worked example

For a June 30 observation with a one-year outcome window, a July 15 collection note cannot be used as an application-time predictor.

Detailed explanation

A model must use only information available at its decision date. Store both the business-effective date and system-ingestion date where possible; a corrected value entered later may not have been known then. Define the outcome window, default events, censoring treatment, and minimum follow-up.

Build labels from event tables with effective dates, then join features as-of the observation time. Test that no feature timestamp exceeds the scoring date and that target events begin after it. Use mature cohorts or survival methods where follow-up varies. Preserve the snapshot logic and cut-off dates so training, validation, and production can be compared on the same basis.

Try a reproducible Python example

These examples use synthetic inputs and run locally in a browser worker. Edit the code, run it, and compare its output with the published example.

Runnable Python · local in your browser

Detect a point-in-time feature leak

A miniature data preparation check compares each feature's observation date with the prediction date.

Output

Run the code to see the output.

Runtime loads only after you press Run. Code runs in a separate browser worker with a 10-second limit and a 20,000-character output cap. Use synthetic examples only; browser execution is not a secure environment for secrets or sensitive records.

Runnable Python · local in your browser

Engineer numeric credit-risk features

Use a training-only median, explicit missingness flags, a log transform, a payment-to-income ratio, and a delinquency indicator. Amounts are synthetic CAD; transforms are illustrative and should be validated for the intended population.

Output

Run the code to see the output.

Runtime loads only after you press Run. Code runs in a separate browser worker with a 10-second limit and a 20,000-character output cap. Use synthetic examples only; browser execution is not a secure environment for secrets or sensitive records.

Assumptions

  • Observation dates, event dates, data arrival delays, and label maturity are represented explicitly.

Limitations

  • Late-arriving source updates can make historical values appear available before they were.
  • Incomplete follow-up creates right censoring.

References

Educational material only. Methods and examples are simplified; state and validate the assumptions required for your use case.

Point-in-time snapshots and performance labels | CreditRiskHub