Understanding Agent-Based Model

An implementation with Python

Valentina Alto
DataSeries
Published in
5 min readJun 7, 2020

--

When we want to model a given phenomenon, we could employ a mathematical underlying structure that we believe describes the scenario. Then, we can parametrize and calibrate it so that our model is able to reproduce patterns seen in data.

This technique is appealing since it provides us with a set of parameters that can be tuned properly, yet it has a caveat: it does not take into account the individual, idiosyncratic behavior of each and every agent in the model. Indeed, it considers a population of individuals as a homogeneous entity, with the risk of losing important, heterogeneous features.

The idea of Agent-Based Model (ABM) is that of bypassing this caveat: with this modeling technique, we are able to initialize a population of agents with a set of behaviors (rules), living in an environment governed by a set of laws (again rules) and then let the agents “behave” without intervening. The interesting fact about this modeling technique is that just observing agents behave according to their inner features (hence, idiosyncratic characteristics), it is possible to anticipate emergent phenomena that are not very intuitive if considered at a macro-level.

In this article, I’m going to propose a very basic ABM, using the Python module Mesa: it is a powerful package…

--

--

Valentina Alto
DataSeries

Data&AI Specialist at @Microsoft | MSc in Data Science | AI, Machine Learning and Running enthusiast