Construct recency, frequency, and monetary features for a prediction row using only prior events.
Build monthly churn RFM features for customers scored at 00:00 on the first day of each month. For each row, filter events to order_ts < score_ts before calculating recency, frequency, or monetary value. A rolling window that includes the score day or later refunds lets the target period explain itself. Cutoff Set score_ts = 2026-04-01 00:00 for the April churn run. The cutoff is the point where the model must stop knowing the future. Filter Keep only transactions where order_ts < score_ts and ingestion_ts <= feature_job_ts. This preserves both business event timing and data availability. Aggregate Compute days_since_last_order, order_count_30d_prior, and…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in