t22000t commited on
Commit
38a74f6
·
verified ·
1 Parent(s): 89b6093

Initial drop: CatBoost + XGBoost baselines on House Prices

Browse files
.gitattributes CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ catboost.cbm filter=lfs diff=lfs merge=lfs -text
37
+ figures/fig_dl_09_actual_vs_predicted.png filter=lfs diff=lfs merge=lfs -text
38
+ figures/fig_dl_12_pdp_top6.png filter=lfs diff=lfs merge=lfs -text
39
+ figures/fig_dl_13_monotonicity_check.png filter=lfs diff=lfs merge=lfs -text
40
+ figures/fig_dl_17_combined_dashboard.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - tabular
5
+ - regression
6
+ - catboost
7
+ - xgboost
8
+ - ensemble
9
+ - house-prices
10
+ - ames-housing
11
+ - kaggle
12
+ library_name: catboost
13
+ pipeline_tag: tabular-regression
14
+ datasets:
15
+ - t22000t/house-prices-tabular
16
+ metrics:
17
+ - gini
18
+ - mae
19
+ - rmse
20
+ model-index:
21
+ - name: house-prices-tabular-models
22
+ results:
23
+ - task:
24
+ type: tabular-regression
25
+ name: Tabular Regression
26
+ dataset:
27
+ type: t22000t/house-prices-tabular
28
+ name: House Prices - Tabular
29
+ metrics:
30
+ - type: gini
31
+ value: 0.2061
32
+ name: Test Gini (CatBoost)
33
+ - type: mae
34
+ value: 16868
35
+ name: Test MAE (CatBoost, USD)
36
+ - type: gini
37
+ value: 0.2049
38
+ name: Test Gini (XGBoost)
39
+ - type: mae
40
+ value: 17204
41
+ name: Test MAE (XGBoost, USD)
42
+ ---
43
+
44
+ # House Prices - Tabular Models (CatBoost + XGBoost baseline)
45
+
46
+ Pre-trained baseline models for the
47
+ [t22000t/house-prices-tabular](https://huggingface.co/datasets/t22000t/house-prices-tabular)
48
+ dataset, produced by the
49
+ [tabular-data-modelling-pipeline](https://github.com/timothy22000/tabular_data_modelling_pipeline).
50
+
51
+ This is the **v1 baseline drop** - CatBoost + XGBoost trained with sensible
52
+ defaults (no Optuna tuning) on an 80/20 random split. A follow-up release
53
+ will add the six deep-learning architectures (CANN, CANN-GBM, FT-Transformer,
54
+ TabM, LocalGLMnet, DRN) once they're retrained on this dataset.
55
+
56
+ ## Results
57
+
58
+ | Model | Test Gini | Train Gini | Test MAE (USD) | Test RMSE (USD) | A/E ratio | n params | Training time |
59
+ |---|---|---|---|---|---|---|---|
60
+ | **CatBoost** | **0.2061** | 0.2203 | **16,868** | 27,063 | 1.025 | 1,041 trees | 4.4 s |
61
+ | XGBoost | 0.2049 | 0.2212 | 17,204 | 29,716 | 0.999 | 462 trees | 0.3 s |
62
+ | Stacked ensemble (NNLS) | 0.2049 | 0.2212 | 17,204 | 29,716 | 0.999 | (2 weights) | - |
63
+
64
+ - **Test set:** 304 rows (20% of 1,460)
65
+ - **Target:** `SalePrice` (USD)
66
+ - **Loss:** Gamma deviance (gamma family, log link)
67
+ - **Target cap:** 99.5th percentile = $555,355 (6 rows winsorised)
68
+ - **Random seed:** 42
69
+
70
+ The NNLS-stacked ensemble currently degenerates to XGBoost; with more diverse
71
+ base learners (the upcoming DL drop) it will pick a non-trivial blend.
72
+
73
+ ## Files
74
+
75
+ | File | What it is | Size |
76
+ |---|---|---|
77
+ | `catboost.cbm` | Trained CatBoost model (native format) | 1.2 MB |
78
+ | `xgboost.json` | Trained XGBoost Booster (native JSON format) | 1.3 MB |
79
+ | `evaluation_summary.csv` | Per-model train/test Gini, MAE, RMSE, A/E ratio, gamma deviance | 315 B |
80
+ | `ensemble_weights.json` | NNLS-stacked weights over base predictions | 53 B |
81
+ | `dashboard_dl_models.html` | Interactive Plotly dashboard (Lorenz curves, calibration deciles, ensemble plots) | 4.6 MB |
82
+ | `figures/fig_dl_*.png` | Publication-quality figures matching the dashboard | ~6 MB total |
83
+ | `model_summary.json` | Structured run record (config, metrics, timing) | 3.2 KB |
84
+
85
+ ## Loading and inference
86
+
87
+ ### CatBoost
88
+
89
+ ```python
90
+ from huggingface_hub import hf_hub_download
91
+ from catboost import CatBoostRegressor
92
+ import pandas as pd
93
+
94
+ path = hf_hub_download(
95
+ repo_id="t22000t/house-prices-tabular-models",
96
+ filename="catboost.cbm",
97
+ )
98
+ model = CatBoostRegressor()
99
+ model.load_model(path)
100
+
101
+ # Load the dataset and predict
102
+ df = pd.read_csv("hf://datasets/t22000t/house-prices-tabular/train.csv")
103
+ # Use only the columns the model was trained on (see model_summary.json)
104
+ features = [
105
+ "LotArea", "YearBuilt", "YearRemodAdd", "TotalBsmtSF", "1stFlrSF",
106
+ "2ndFlrSF", "GrLivArea", "FullBath", "BedroomAbvGr", "TotRmsAbvGrd",
107
+ "GarageCars", "GarageArea", "OverallQual", "OverallCond",
108
+ "MSZoning", "Street", "LotShape", "Neighborhood", "BldgType",
109
+ "HouseStyle", "RoofStyle", "ExterQual", "Foundation", "Heating",
110
+ "CentralAir", "KitchenQual", "SaleType", "SaleCondition",
111
+ ]
112
+ preds = model.predict(df[features])
113
+ ```
114
+
115
+ ### XGBoost
116
+
117
+ ```python
118
+ from huggingface_hub import hf_hub_download
119
+ import xgboost as xgb
120
+
121
+ path = hf_hub_download(
122
+ repo_id="t22000t/house-prices-tabular-models",
123
+ filename="xgboost.json",
124
+ )
125
+ booster = xgb.Booster()
126
+ booster.load_model(path)
127
+
128
+ # Predictions require the exact feature order used at training time;
129
+ # easiest path is to re-run the pipeline's preprocessing - see the
130
+ # GitHub repo for the full feature build code.
131
+ ```
132
+
133
+ ### Stacked ensemble
134
+
135
+ ```python
136
+ import json
137
+ from huggingface_hub import hf_hub_download
138
+
139
+ path = hf_hub_download(
140
+ repo_id="t22000t/house-prices-tabular-models",
141
+ filename="ensemble_weights.json",
142
+ )
143
+ weights = json.loads(open(path).read())
144
+ # weights = {"catboost": 0.0, "xgboost": 1.0} (NNLS picked XGBoost only)
145
+ ensemble_pred = weights["catboost"] * cb_pred + weights["xgboost"] * xgb_pred
146
+ ```
147
+
148
+ ## Training configuration
149
+
150
+ | Setting | Value |
151
+ |---|---|
152
+ | Pipeline | [tabular-data-modelling-pipeline](https://github.com/timothy22000/tabular_data_modelling_pipeline) v0.1.0 |
153
+ | Architecture mix | CatBoost + XGBoost (DL models excluded from this drop) |
154
+ | Hyperparameters | Defaults (see `modelling/models/__init__.py`) - **no Optuna tuning** |
155
+ | Optimiser | CatBoost: ordered boosting; XGBoost: hist tree method |
156
+ | Family / link | Gamma / log |
157
+ | Train/test split | Random 80/20, seed 42 |
158
+ | Cap percentile | 99.5 |
159
+ | CV folds | 5 (for stability check) |
160
+ | Hardware | Apple M-series, CPU |
161
+
162
+ To reproduce exactly, run:
163
+ ```bash
164
+ git clone https://github.com/timothy22000/tabular_data_modelling_pipeline
165
+ cd tabular_data_modelling_pipeline
166
+ pip install -e ".[gbm,viz]"
167
+ python scripts/download_data.py --dataset house_prices
168
+
169
+ OMP_NUM_THREADS=1 python train.py \
170
+ --config configs/example_house_prices.py \
171
+ --input data/house_prices.csv \
172
+ --skip-tuning --skip-interpretability \
173
+ --architectures catboost xgboost
174
+ ```
175
+
176
+ (`OMP_NUM_THREADS=1` is only needed on macOS arm64 to avoid an OpenMP
177
+ conflict between XGBoost and Python's threading; Linux runs are unaffected.)
178
+
179
+ ## Limitations
180
+
181
+ - **Defaults only.** No hyperparameter tuning - tuned models would close
182
+ the train-test gap and likely lift Gini by 0.02-0.05.
183
+ - **GBM only.** This drop omits the six DL architectures. CANN-GBM in
184
+ particular would likely outperform raw XGBoost since it adds a neural
185
+ residual on top of the GBM base. v2 will include these.
186
+ - **Random split, not stratified.** SalePrice has a heavy right tail; a
187
+ stratified split (or quantile-stratified) would give a more representative
188
+ test set. Default behaviour, kept for reproducibility.
189
+ - **Trained on training set only.** The Kaggle competition's `test.csv`
190
+ is unlabelled and not used here. To compare against the official
191
+ leaderboard, train on the full set and submit predictions on test.
192
+ - **Gini scores look modest.** Gini in [0.20, 0.22] is reasonable for
193
+ this dataset's modest signal-to-noise ratio - Kaggle leaderboard RMSLE
194
+ is the more conventional metric for House Prices, but the pipeline
195
+ uses Gini and MAE for cross-comparability across architectures and
196
+ datasets.
197
+
198
+ ## Intended use
199
+
200
+ - **Baseline for tabular DL research.** Comparing your new architecture
201
+ against these numbers.
202
+ - **Teaching.** Demonstrating a calibrated tabular pricing pipeline end
203
+ to end.
204
+ - **Sanity check.** Make sure your reimplementation of CatBoost/XGBoost
205
+ on this data hits similar numbers.
206
+
207
+ ## Citation
208
+
209
+ ```bibtex
210
+ @software{tabular_data_modelling_pipeline,
211
+ author = {Mun, Timothy},
212
+ title = {tabular-data-modelling-pipeline},
213
+ url = {https://github.com/timothy22000/tabular_data_modelling_pipeline},
214
+ year = {2026}
215
+ }
216
+
217
+ @article{decock2011ames,
218
+ author = {De Cock, Dean},
219
+ title = {Ames, Iowa: Alternative to the Boston Housing Data},
220
+ journal = {Journal of Statistics Education},
221
+ volume = {19},
222
+ number = {3},
223
+ year = {2011}
224
+ }
225
+ ```
226
+
227
+ ## License
228
+
229
+ MIT for the model code and pipeline. The underlying dataset is
230
+ distributed under Kaggle competition terms (free use with attribution).
231
+
232
+ ## Related
233
+
234
+ - 📂 [Dataset: t22000t/house-prices-tabular](https://huggingface.co/datasets/t22000t/house-prices-tabular)
235
+ - 📦 [Pipeline: tabular-data-modelling-pipeline](https://github.com/timothy22000/tabular_data_modelling_pipeline)
236
+ - 🔒 [Privacy Lab Space](https://huggingface.co/spaces/t22000t/privacy-lab) - anonymize tabular data + red-team it
catboost.cbm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53867c266dfa9f165312fcec571af3877b8a290e806e79e8b9e0aacefe766383
3
+ size 1216500
dashboard_dl_models.html ADDED
The diff for this file is too large to render. See raw diff
 
ensemble_weights.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "glm": 0.0,
3
+ "catboost": 0.0,
4
+ "xgboost": 1.0
5
+ }
evaluation_summary.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ model,gini_train,gini_test,mae,rmse,cv_rmse,ae_ratio,gamma_deviance,n_params,training_time
2
+ catboost,0.2203,0.2061,16868.04,27062.87,0.1441,1.025,-4.476422,1041,4.4
3
+ xgboost,0.2212,0.2049,17203.89,29715.99,0.1582,0.9985,-4.691965,462,0.3
4
+ stacked_ensemble,0.2212,0.2049,17203.89,29715.99,0.1582,0.9985,-4.691965,3,0.0
figures/fig_dl_01_gini_comparison.png ADDED
figures/fig_dl_02_lorenz_curves.png ADDED
figures/fig_dl_08_calibration_deciles.png ADDED
figures/fig_dl_09_actual_vs_predicted.png ADDED

Git LFS Details

  • SHA256: cb02918feb6df596520ef6f1d3cc9dac7a4286b3f7e8b92e99fb865de46d7081
  • Pointer size: 131 Bytes
  • Size of remote file: 134 kB
figures/fig_dl_10_ensemble_weights.png ADDED
figures/fig_dl_12_pdp_top6.png ADDED

Git LFS Details

  • SHA256: 33ddcb4c53b1be58db63010239cb8a412f5187946d9a9b00c75fdc2ee05b1367
  • Pointer size: 131 Bytes
  • Size of remote file: 121 kB
figures/fig_dl_13_monotonicity_check.png ADDED

Git LFS Details

  • SHA256: 19c4aa9c3f1872f8330ccba9458840321ab0e3d560ea6edaa4ad707351dafd1f
  • Pointer size: 131 Bytes
  • Size of remote file: 150 kB
figures/fig_dl_14_cv_stability.png ADDED
figures/fig_dl_15_model_complexity.png ADDED
figures/fig_dl_16_residual_distribution.png ADDED
figures/fig_dl_17_combined_dashboard.png ADDED

Git LFS Details

  • SHA256: 9d7e712ee025712198fecd1097d15b5f43563efc42ef545cc640497930dcaa12
  • Pointer size: 131 Bytes
  • Size of remote file: 223 kB
model_summary.json ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "pipeline": "dl",
3
+ "timestamp": "2026-05-27T22:08:09.831216",
4
+ "config": {
5
+ "seed": 42,
6
+ "n_tuning_trials": 30,
7
+ "cv_folds": 5,
8
+ "quick": false,
9
+ "architectures": [
10
+ "catboost",
11
+ "xgboost"
12
+ ],
13
+ "epochs": 300,
14
+ "patience": 30,
15
+ "batch_size": 512,
16
+ "n_ensemble": 3,
17
+ "catboost_iterations": 2000,
18
+ "mono_lambda": 0.1
19
+ },
20
+ "best_model": "catboost",
21
+ "double_lift_vs_glm": 20.9939,
22
+ "glm_gini": 0.009817159273634912,
23
+ "models": {
24
+ "catboost": {
25
+ "metrics_train": {
26
+ "split": "train",
27
+ "n": 1156,
28
+ "n_params": 0,
29
+ "gini": 0.220273,
30
+ "mae": 9229.8045,
31
+ "rmse": 12359.3171,
32
+ "cv_rmse": 0.069188,
33
+ "ae_ratio": 1.036369,
34
+ "mean_actual": 178634.4191,
35
+ "mean_predicted": 172365.6919,
36
+ "gamma_deviance": -6.358849
37
+ },
38
+ "metrics_test": {
39
+ "split": "test",
40
+ "n": 304,
41
+ "n_params": 0,
42
+ "gini": 0.206072,
43
+ "mae": 16868.0377,
44
+ "rmse": 27062.8666,
45
+ "cv_rmse": 0.144084,
46
+ "ae_ratio": 1.02497,
47
+ "mean_actual": 187827.3717,
48
+ "mean_predicted": 183251.5518,
49
+ "gamma_deviance": -4.476422
50
+ },
51
+ "training_time": 4.425956964492798,
52
+ "best_params": {},
53
+ "n_params": 1041
54
+ },
55
+ "xgboost": {
56
+ "metrics_train": {
57
+ "split": "train",
58
+ "n": 1156,
59
+ "n_params": 0,
60
+ "gini": 0.221199,
61
+ "mae": 5759.4073,
62
+ "rmse": 7959.4927,
63
+ "cv_rmse": 0.044557,
64
+ "ae_ratio": 1.002072,
65
+ "mean_actual": 178634.4191,
66
+ "mean_predicted": 178265.0061,
67
+ "gamma_deviance": -2.187904
68
+ },
69
+ "metrics_test": {
70
+ "split": "test",
71
+ "n": 304,
72
+ "n_params": 0,
73
+ "gini": 0.20495,
74
+ "mae": 17203.8948,
75
+ "rmse": 29715.992,
76
+ "cv_rmse": 0.158209,
77
+ "ae_ratio": 0.998457,
78
+ "mean_actual": 187827.3717,
79
+ "mean_predicted": 188117.697,
80
+ "gamma_deviance": -4.691965
81
+ },
82
+ "training_time": 0.27405214309692383,
83
+ "best_params": {
84
+ "max_depth": 6,
85
+ "eta": 0.05,
86
+ "n_estimators": 1000,
87
+ "reg_alpha": 0.1,
88
+ "reg_lambda": 1.0,
89
+ "subsample": 0.85,
90
+ "colsample_bytree": 0.85,
91
+ "early_stopping_rounds": 50
92
+ },
93
+ "n_params": 462
94
+ },
95
+ "stacked_ensemble": {
96
+ "metrics_train": {
97
+ "split": "train",
98
+ "n": 1156,
99
+ "n_params": 0,
100
+ "gini": 0.221199,
101
+ "mae": 5759.4073,
102
+ "rmse": 7959.4927,
103
+ "cv_rmse": 0.044557,
104
+ "ae_ratio": 1.002072,
105
+ "mean_actual": 178634.4191,
106
+ "mean_predicted": 178265.0061,
107
+ "gamma_deviance": -2.187904
108
+ },
109
+ "metrics_test": {
110
+ "split": "test",
111
+ "n": 304,
112
+ "n_params": 0,
113
+ "gini": 0.20495,
114
+ "mae": 17203.8948,
115
+ "rmse": 29715.992,
116
+ "cv_rmse": 0.158209,
117
+ "ae_ratio": 0.998457,
118
+ "mean_actual": 187827.3717,
119
+ "mean_predicted": 188117.697,
120
+ "gamma_deviance": -4.691965
121
+ },
122
+ "training_time": 0.003686189651489258,
123
+ "best_params": {},
124
+ "n_params": 3,
125
+ "base_weights": {
126
+ "glm": 0.0,
127
+ "catboost": 0.0,
128
+ "xgboost": 1.0
129
+ }
130
+ }
131
+ }
132
+ }
xgboost.json ADDED
The diff for this file is too large to render. See raw diff