Design and diagnose a regression pipeline
Problem Description
You are tasked with designing an end-to-end regression pipeline to predict the 90-day customer lifetime value (CLV_90) at the individual user level.
Context
The target variable, CLV_90, exhibits specific characteristics:
- Many zero values (zero-inflation).
- A heavy right tail (skewed distribution).
Features are available up to a fixed cutoff date for each user and include:
- Continuous Spend Features: Spend_SEM, Spend_Social, Spend_Display.
- RFM Features: Recency, Frequency, Monetary.
- Categorical Features: Device, Region, Tenure.
- High-Cardinality Features: Dozens of sparse campaign IDs.
Known challenges with the dataset include:
- Strong multicollinearity among the continuous spend channels.
- Heteroskedastic errors.
- Nonlinear effects within the data.
Task Requirements
Your design must address the following aspects:
- Loss Function and Distribution: Select and justify an appropriate loss function and underlying distribution for the target variable. Consider options such as log-link Generalized Linear Models (GLM), Tweedie distribution, zero-inflated or hurdle models, quantile regression, or gradient-boosted regression.
- Feature Processing: Detail the necessary feature engineering steps, including:
log1ptransformations.- Standardization.
- Bucketing of rare categories.
- Target encoding for high-cardinality features, specifically using K-fold out-of-fold encoding to prevent data leakage.
- Multicollinearity and Feature Selection: Propose methods to handle multicollinearity and perform feature selection. This should include a discussion of Ridge, Lasso, and Elastic Net regularization. You must write the objective function for Elastic Net, clearly defining the roles of its
αandλparameters and explaining when each penalty type (L1 vs. L2) dominates. - Cross-Validation Strategy: Design a time-based nested cross-validation scheme. Explain how this strategy prevents leakage from future signals and avoids issues related to campaign overlap.
- Model Assumption Diagnosis and Mitigation: Describe how to diagnose and mitigate common model assumption violations:
- Heteroskedasticity: Discuss robust standard errors, variance-stabilizing transformations, or leveraging the mean-variance relationship in Tweedie models.
- Nonlinearity: Address with techniques like splines or interaction terms.
- Influential Outliers: Mitigate using robust loss functions such as Huber or Tukey loss.
- Prediction Intervals: Provide a method for generating calibrated 95% prediction intervals for CLV_90. Compare approaches like conformal prediction or bootstrapping against traditional Ordinary Least Squares (OLS) analytic intervals.
- Effect Interpretation: Explain how to interpret feature effects. Compare standardized coefficients from a regularized linear model with SHAP (SHapley Additive exPlanations) values from a tree-based model.
- Data Leakage Risks: Identify, quantify, and propose mitigations for data leakage risks. Specifically address target leakage from post-cutoff features and look-ahead bias in target encoding.
- Model Comparison and Metrics: Compare the performance and interpretability trade-offs between a regularized linear model and a gradient-boosting model. Specify evaluation metrics that are robust to heavy-tailed distributions, such as Mean Absolute Error (MAE), Quantile loss, or Mean Absolute Percentage Error (MAPE) with an epsilon term.
AI interview prep
Core dilemma
Balancing the complexity of modeling a highly irregular target variable (zero-inflated, heavy-tailed, heteroskedastic) with the need for robust, interpretable, and leak-proof predictions in a time-series context.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design and diagnose a regression pipeline
Problem Description
You are tasked with designing an end-to-end regression pipeline to predict the 90-day customer lifetime value (CLV_90) at the individual user level.
Context
The target variable, CLV_90, exhibits specific characteristics:
- Many zero values (zero-inflation).
- A heavy right tail (skewed distribution).
Features are available up to a fixed cutoff date for each user and include:
- Continuous Spend Features: Spend_SEM, Spend_Social, Spend_Display.
- RFM Features: Recency, Frequency, Monetary.
- Categorical Features: Device, Region, Tenure.
- High-Cardinality Features: Dozens of sparse campaign IDs.
Known challenges with the dataset include:
- Strong multicollinearity among the continuous spend channels.
- Heteroskedastic errors.
- Nonlinear effects within the data.
Task Requirements
Your design must address the following aspects:
- Loss Function and Distribution: Select and justify an appropriate loss function and underlying distribution for the target variable. Consider options such as log-link Generalized Linear Models (GLM), Tweedie distribution, zero-inflated or hurdle models, quantile regression, or gradient-boosted regression.
- Feature Processing: Detail the necessary feature engineering steps, including:
log1ptransformations.- Standardization.
- Bucketing of rare categories.
- Target encoding for high-cardinality features, specifically using K-fold out-of-fold encoding to prevent data leakage.
- Multicollinearity and Feature Selection: Propose methods to handle multicollinearity and perform feature selection. This should include a discussion of Ridge, Lasso, and Elastic Net regularization. You must write the objective function for Elastic Net, clearly defining the roles of its
αandλparameters and explaining when each penalty type (L1 vs. L2) dominates. - Cross-Validation Strategy: Design a time-based nested cross-validation scheme. Explain how this strategy prevents leakage from future signals and avoids issues related to campaign overlap.
- Model Assumption Diagnosis and Mitigation: Describe how to diagnose and mitigate common model assumption violations:
- Heteroskedasticity: Discuss robust standard errors, variance-stabilizing transformations, or leveraging the mean-variance relationship in Tweedie models.
- Nonlinearity: Address with techniques like splines or interaction terms.
- Influential Outliers: Mitigate using robust loss functions such as Huber or Tukey loss.
- Prediction Intervals: Provide a method for generating calibrated 95% prediction intervals for CLV_90. Compare approaches like conformal prediction or bootstrapping against traditional Ordinary Least Squares (OLS) analytic intervals.
- Effect Interpretation: Explain how to interpret feature effects. Compare standardized coefficients from a regularized linear model with SHAP (SHapley Additive exPlanations) values from a tree-based model.
- Data Leakage Risks: Identify, quantify, and propose mitigations for data leakage risks. Specifically address target leakage from post-cutoff features and look-ahead bias in target encoding.
- Model Comparison and Metrics: Compare the performance and interpretability trade-offs between a regularized linear model and a gradient-boosting model. Specify evaluation metrics that are robust to heavy-tailed distributions, such as Mean Absolute Error (MAE), Quantile loss, or Mean Absolute Percentage Error (MAPE) with an epsilon term.