FourThirtyFive
- 8 Devlogs
- 23 Total hours
My personal attempt at predicting the 2026 United States Midterms!
My personal attempt at predicting the 2026 United States Midterms!
And that is a wrap, ladies and gentlemen!
I got it deployed on web with no further issues, and I will now generate a DNS record to give it my custom domain, and then I’ll ship.
I’m pretty excited to see what y’all think about the project, hope you like it!
I think that it is as good as done at this stage, now I’m just going to flesh out the README and citations and ship.
I also need to deploy it to web pronto because for some reason I never thought to test it on anything but Linux desktop until now, thankfully, it is Flutter so it should be straightforward.
The large commit log is attached so you can see how much effort has gone into the project (even if sporadic).
Look at this beautiful infobox!
I have also refined a lot of the code further, did some much needed housekeeping (such as updating polls), and now will be adding governor races too.
I hate myself for procrastinating so much, but I believe I can get something good in in time for Halloween.
Now my pace is picking up, I’ve already gotten the initial work in place for showing info about the election!
I needed to scrape the infobox from the Wikipedia page on the election (in this case https://en.wikipedia.org/wiki/2026_United_States_Senate_election_in_Texas), pass a useragent so it doesn’t deny access, and then render the HTML within the app, which works suprisingly beautifully in both dark and light mode.
After a hell of a lot of procrastination and conflicts in my head on what to do, I finally have a almost-complete interface!
As you can see, this model predicts outcomes that align fairly well with models such as RaceToTheWH or Silver Bulletin, if a bit D-optimistic (probably due to the data-driven nature of the model, which I believed was the right path).
I want to add some QoL improvements such as candidate names, methodology breakdowns per prediction, and maybe even the latest news per race, but I think overall it’s fairly close to shipping!
Well, I switched to a ridge regression model, which yielded far better results. Did you know most regression models can have inference run with just a few basic json parameters? Well, I didn’t until today, but they can.
Anyway, with that done and mostly accurate, I got my first prediction working and with the assistance of Copilot, even a window! Now, there is still serious work on the table, but it feel good to finally have something tangible, doesn’t it?
It seems that maybe using a gradient-boosted tree with the limited features I can use with only 12 data points is perhaps a bad idea….
A one-point swing in the generic ballot causes a double-digit swing in the predicted national lean, turning a predicted blue wave into a comfortable Republican win.
Preprocessing the data is finally over (I really slacked off for a while, bad idea)!
This was actually fairly straightforward to do, it’s just that I kept having different ideas on how to implement the model. What I ended up settling on is a XGBoost gradient-boosted tree that predicts the national House lean (even though this will start by predicting Senate races) using three fundamentals, and then it will use a polling aggregate per race that gets more weight as election day nears.