Projects / optimization
optimization
Random forest and LightGBM tuning on the UCI Adult income set, then a calibration check.
Why
Tuning writeups usually stop at a higher accuracy. A probability that is sharp and wrong is a different failure. I wanted the search methods next to each other, and then a check that the scores mean what they say.
Diagrams
A solid outline is the path in the repo. A dashed outline is the alternative that shape is refusing.
The set is UCI Adult. The lab runs random search, Optuna, threshold sweeps, and the other tuners in the repo from weak baselines. calibrate.py prints binned predicted rates against actual rates, with Brier and ECE.
flowchart TD
adult["UCI Adult"]
search["Random search, Optuna, threshold sweeps"]
pipe["Saved pipeline"]
cal["calibrate.py"]
adult --> search --> pipe --> cal
class adult,search,pipe,cal chosen
A higher accuracy is not the last line. A probability that says 0.8 when the bin was 0.5 is a different failure, and a single accuracy number cannot show it.
flowchart TD
q{After the search}
q -->|"predicted rate against actual rate"| cal["Binned calibration"]
q -->|"accuracy and stop"| acc["Accuracy only"]
class cal chosen
class acc rejected
Why this shape
The lab starts from weak baselines and runs the tuners across the same data: random search, Optuna, threshold sweeps, and the others in the repo. calibrate.py takes a saved pipeline and a CSV and prints binned predicted rates against actual rates, with Brier and ECE. The bins are the point. A single accuracy number cannot show that 0.8 meant 0.5.
Where it breaks
Adult income is a clean public set. A tuner that wins on it has not won on a set with a different base rate. ECE also depends on how you bin. Ten bins and a hundred bins will not scold the same model.