MLP Project Notes

Project playbook

The order I'd do things in if I started the MLP project again. Works for most tabular Kaggle problems.

Before you write code

1. Understand the metric

RMSLE is RMSE on log(1 + y). It judges errors as percentages, so a 10k miss on a cheap machine costs more than on an expensive one. Train on np.log1p(y), predict, then np.expm1. Your training loss now equals the metric, and the right skew of prices disappears.

2. EDA that earns marks

End every plot with a short written observation. Examiners pick a chart and ask what it shows.

3. Features

IdeaWhy it helps
Date parts + days since startPrices drift over time
Age = sale year − manufacture year, clippedStrongest single driver of price
log hours, hours per year, missing and zero flagsUsage is skewed; "not recorded" ≠ "zero"
Ordinal map for Low / Medium / HighKeeps the order a label encoder loses
Category × category combosInteractions a single split can't express
Features from related rowsSame-batch and comparable past sales carried the most signal

4. Encoding by cardinality

Smoothing formula: (mean × count + global_mean × k) / (count + k). A category seen twice gets pulled toward the global mean instead of taking an extreme value.

5. Leakage checklist

6. Models

Compare at least: Ridge (linear reference), Random Forest (bagging), XGBoost, LightGBM, CatBoost. On a 40k-row sample my holdout scores were roughly XGBoost 0.221, LightGBM 0.224, CatBoost 0.233, Random Forest 0.237, Ridge 0.414. Boosting wins on tabular data because each tree fixes the previous trees' residuals.

Give the ensemble variety: two XGBoost models of different depth, a wide-leaf LightGBM, and CatBoost with its symmetric trees made errors that overlapped less.

7. Blending

  1. Collect out-of-fold predictions from each model
  2. Print their correlation; low correlation means blending will help
  3. Fit Ridge(positive=True) on the OOF columns to learn weights
  4. Refit each model on all data, apply the weights to test predictions
  5. Repeat with several seeds and average in log space
  6. Clip tiny predictions and reindex to the sample submission order

Keep a results log. A plain text file with version, idea, local CV and real leaderboard score. It stopped me from repeating failed ideas.