Using Hierarchical Multinomial Regression to Predict Elections in Paris at the District-Level by Alex Andorra

Talk Abstract

Predicting elections in Paris with hierarchical multinomial regression.

Do you want to use multinomial/softmax regression but don’t know how to code that up? Well (at once), there is a tutorial about this! You’ll learn how to write these models with PyMC3 and ArviZ, using a non-trivial example: a hierarchical multinomial regression to predict city-council elections in Paris at the district-level, using opinion polls and unemployment data as predictors.

Beyond its originality, this example illustrates useful tricks when building Bayesian models: dealing with sparse and unreliable data, changes in electoral rules over time, multi-dimensionality, probability distributions that are not often used in tutorials but are harder to fit than your vanilla Gaussian, space and time variation, hierarchical structure, etc. As a bonus, we’ll visualize our results with a beautiful, interactive map of Paris districts, using Bokeh.

TL; DR: this is not yet another Iris data example — so come and watch!


Alex Andorra

By day, Alex is a data scientist and modeler at the brand new PyMC | Labs consultancy. By night, he doesn’t (yet) fight crime, but he’s an open-source enthusiast and core contributor to the python packages PyMC and ArviZ. Alex is also the creator and host of the only podcast dedicated to Bayesian statistics, “Learning Bayesian Statistics”. Every fortnight, he interviews practitioners of all fields about why and how they use Bayesian statistics. He also loves Nutella a bit too much, but he doesn’t like talking about it – he prefers eating it.

This is a PyMCon 2020 talk

Learn more about PyMCon!

PyMCon is an asynchronous-first virtual conference for the Bayesian community.

We have posted all the talks here in Discourse on October 24th, one week before the live PyMCon session for everyone to see and discuss at their own pace.

If you are available on October 31st you can register for the live session here!, but if you are not don’t worry, all the talks are already available here on Discourse (keynotes will be posted after the conference) and you can network here on Discourse and on our Zulip.

We value the participation of each member of the PyMC community and want all attendees to have an enjoyable and fulfilling experience. Accordingly, all attendees are expected to show respect and courtesy to other attendees throughout the conference and at all conference events. Everyone taking part in PyMCon activities must abide by the PyMCon Code of Conduct. You can report any incident through this from.

If you want to support PyMCon and the PyMC community but you can’t attend the live session, consider donating to PyMC

Do you have suggestions to improve PyMCon? We have an anonymous suggestion box waiting for you

Have you enjoyed PyMCon? Please fill our PyMCon attendee survey. It is open to both async PyMCon attendees and people taking part in the live session.


Hey folks! Hope you’ll find this talk useful, and I’m happy to answer questions and comments :slight_smile:
Here is the GitHub repo with all the material, as explained in the video :champagne:
And I’ll take the opportunity to thank here @junpenglao, @aseyboldt and @OriolAbril who gave me wise and patient advice and helped a lot with this project :pray:
Live long and PyMCheers :vulcan_salute: