Ames housing stacked ensemble
Five models, out of fold predictions, and a baseline table that keeps the stack honest.
A stacked Ames pipeline with log target, outlier policy, ordinal encoding, and fold safe preprocessing.
- Role
- Build and evaluation
- Year
- Pending
- Case study
- 499 words
- Demo
- Client side
Result: the stack blends XGBoost, LightGBM, CatBoost, Ridge, and Lasso on a log target. The final RMSE is add the stack score in log space.
Problem
Ames is a small tabular dataset with a long tail of prices and a lot of categorical detail. It is also a trap for leakage. The goal was not a higher leaderboard score at any cost. The goal was a stack that could beat a single model under a fold safe pipeline.
Data
The dataset is the Ames housing table. The target is sale price. The train and validation design is add fold count, repeats, and seed policy. Outliers are handled with add the exact rule and where it is fit.
Approach and why
- Log transform the target to reduce the influence of expensive homes.
- Use an explicit outlier policy, fit inside each fold if the rule uses the data.
- Ordinal encode ordered categorical features and keep the order documented.
- Fit every preprocessing step inside a pipeline so it cannot see the validation fold.
- Train XGBoost, LightGBM, CatBoost, Ridge, and Lasso.
- Generate out of fold predictions and fit the stack on those predictions.
- Compare the stack with a mean baseline, Ridge, and the best single model.
The stack is only useful if it beats the best single model. The baseline table is the claim.
Results
| Model | RMSE, log target | Notes |
|---|---|---|
| Mean baseline | add score | Predicts the training mean |
| Ridge | add score | Linear baseline |
| Best single model | add model and score | add which model |
| Stack | add score | Out of fold predictions |
The back transformed error in price units is add score and transform details. The leaderboard rank is add rank or remove the claim.
Evaluation
- Leakage: outlier removal and any target based encoding must be fit inside the fold. The pipeline is checked for this.
- Baseline: mean, Ridge, and the best single model.
- Validation: repeated K fold with fixed seeds. Out of fold predictions are used for the stack.
- Metric: RMSE on the log target, plus the back transformed error. The transform is stated.
- Reproducibility: pinned dependencies, saved fold assignments, fixed seeds, and model artifacts.
A reviewer should challenge any stack score produced on the same data used to fit the weights. That is the most likely optimistic result here.
Limitations
The dataset is small and old. The outlier policy can change the score. The stack adds complexity for a gain that must be shown, not assumed. The result is pending, so no ranking claim.
Next steps
Run nested cross validation, report mean and standard deviation across repeats, add SHAP explanations, and package the pipeline behind a typed inference endpoint if the deployment path is confirmed.
Links
- Repo: add repository URL
- Demo: Try the price predictor
Ames price surrogate
Move the inputs to see how a small additive surrogate responds. The real project is a stacked ensemble with fold safe preprocessing. This demo is a transparent approximation for interaction, not the trained model.
Surrogate estimate
$245,900
Additive approximation, not model output
Contribution style breakdown
- Overall quality6 / 10+$14,000
- Living area1,600 sq ft+$9,500
- Garage cars2+$9,000
- Year built1998+$9,800
- Basement area1,000 sq ft+$5,600
- NeighborhoodNorth Ames+$18,000
Surrogate model for interaction only. The trained stacked ensemble and its RMSE are in the case study. This demo makes no accuracy claim.
Headline metrics
- RMSE, log target
- $245,900
- Best single model
- LightGBM
Case study length
499 / 500