Municipal Election Outcome Intelligence
What can historical election data tell us before the votes are counted?
I built a machine learning workflow on the Canadian Municipal Elections Database, 123,416 candidate records, to test whether information available before an election can estimate a candidate’s chance of being elected. The goal was an honest estimate, so a large part of the work was making sure the model never saw the answer.
- Cleaned and filtered the records to 91,768 contested races
- Removed vote totals and other outcome-leaking fields to keep results realistic
- Compared Logistic Regression and Random Forest against a majority class baseline
- Used grouped cross validation so candidates from one race never split across folds
- Built a FastAPI service that returns a prediction and a probability for a new candidate
Evaluated on 7,911 candidates from 2022 elections the model never trained on.




