This week we welcome Janos Gabler (@JanosGabler) as our PyDev of the Week! Janos is the creator of estimagic, a Python package for nonlinear optimization. You can catch up with Janos on his website or by checking out Janos’ GitHub Profile.
Let’s spend some time getting to know Janos better!
Can you tell us a little about yourself (hobbies, education, etc.)
I am Janos. I live in Bonn, Germany, where I did a PhD in economics. I am now a postdoc at the University of Bonn and teach “Effective Programming Practices for Economists” and “Scientific computing”.
My contract runs until October. I am currently deciding what I want to do next. Most likely, I will be looking for Jobs in AI or the scientific Python ecosystem, but there is a slight chance of founding a startup.
While I try to avoid yak-shaving at work, I fully embrace it in my hobbies. For example, I like baking, which eventually led me to build my own wood-fired brick oven. I also enjoy woodworking, and the bookshelf I am currently building required me to learn to weld, so I could construct a big bandsaw out of scrap metal which I needed to resaw the boards for the shelf.
Why did you start using Python?
I started using Python in 2015 for empirical research (using pandas and statsmodels). I had no previous experience in any other programming language and did not expect programming to be something I would enjoy. This changed very quickly!
I was lucky to attend “Effective programming practices for Economists” (the class I am teaching now) right at the beginning of my programming journey. This introduced me to git, unit testing and best practices.
The projects quickly became more challenging. There was a short period when I regretted picking a “slow language”, but I quickly learned how to get around that. First with Cython, then Numba and nowadays JAX.
What other programming languages do you know and which is your favorite?
It speaks for Python that I don’t know any other programming language well. I have some experience in Fortran, Matlab, C, and R, but I did all my computational projects during my PhD in Python.
I guess this also answers the question of which language is my favorite?
Having said that, I enjoy reading code in other languages and would like to learn a functional language like Haskell when I find the time.
What projects are you working on now?
My main focus is deep learning and natural language processing, and I am interested in how AI can make us more productive. In a few years, scientists and programmers will use very different tools than now and will be vastly more effective. Things like GitHub copilot are just the start. I want to be part of that process, either by working on better language models or by integrating language models into next-generation tools.
On the side, I continue working on estimagic together with amazing contributors. The goal of estimagic is to enable scientists who are not experts in numerical optimization to solve challenging optimization problems in practice. They should not have to care too much about selecting algorithms or setting their tuning parameters. We are therefore developing new algorithms that are more adaptive and automatically adjust some tuning parameters that previously had to be specified by a user.
Which Python libraries are your favorite (core or 3rd party)?
You mean besides estimagic? There are so many libraries I really like and use a lot:
One of my absolute favorites is JAX. First, it gives you automatic differentiation, Jit compilation, and GPU acceleration almost for free if you know numpy. But it does not stop there. Vmap lets you vectorize functions, and you can thus write simple functions that are easy to test and vectorize later. And due to pytrees (think of them as nested dictionaries if you haven’t heard the term), you can use quite flexible data structures in places where the math (and most libraries) expect one-dimensional numpy arrays.
Pytask is a workflow management system for reproducible research inspired by pytest. It is really easy to use, especially if you already know pytest, and I have used it for all my research projects in my PhD.
One of my favorite core libraries is inspect. It lets you check the signatures of functions at runtime. So if you are wrapping functions, you can look at their signature and call them with the correct arguments.
I am also continuously amazed by the foundational libraries numpy and scipy. None of the things I do would be possible in Python without them. I first really appreciated this at last year’s scipy conference. BTW: I’ll be at the scipy conference in Austin again and happy to chat!
What’s the origin story of estimagic?
In computational economics, we encounter a lot of challenging optimization problems. Either to solve economic models or to fit their parameters to data. There were many good open-source optimizers, but they were scattered across different libraries. Most of them forced me to put start parameters into an unlabeled array, making it hard to see which parameter was which. Few provided error handling, logging, and other convenience features.
Estimagic is based on the insight that all of these features can be added to existing optimizers by wrapping them, i.e., without modifying their source code. I wrote a very rudimentary prototype in 2019 where parameters could be provided as a pandas DataFrame (so the index provided names), constraints could be implemented via reparametrization, and the optimization could be monitored in real-time in a dashboard. It was horrible but good enough to excite some people about the idea. Together we built estimagic into something better than I ever would have imagined.
What are some of the most unusual scientific models you have seen estimagic used for?
The most unusual application I heard of was not a scientific model. While giving a tutorial on estimagic, I met an aerospace engineer who works on flying taxis that can take off and land vertically. I love the idea there might be a flying taxi that contains a part optimized with estimagic!
Is there anything else you’d like to say?
I encourage everyone who uses a small open-source library to contact the authors and provide feedback. As a user, you often get a feature you want or a fix for free. As a maintainer, you get a chance to make your library better. And while you are at it, give them a star on GitHub.
Thanks so much for doing the interview, Janos!
Pingback: ICYMI Python on Microcontrollers Newsletter: CircuitPython 8.1.0beta0 Out, New RasPi Pico Documentation and Much More! #CircuitPython #Python #micropython #ICYMI @Raspberry_Pi « Adafruit Industries – Makers, hackers, artists, designers and eng