This week: a multi-armed bandit and a opinion dynamics model, both written in Julia by chance. That sparked a rabbit hole of reading about the language.

A penguin-fish recommender systems using multi-armed bandits, pt. 1

Author: Sebastian Callh

This long post motivates, introduces, and implements multi-armed bandits for the problem of deciding which of three fish to feed three species of penguins. I’ve read a little bit about multi-armed bandits, but this was a simple but concrete application that I learned a lot from.

One of the things I appreciated about this post is that it was written in Julia. This made me less able to follow the code than if it were written in Python, but I was exposed to non-trivial Julia code for the first time. I would love to try out the language some time.


From Python to Julia & Learning by Doing: A Case Study with an Opinion Dynamics Model Simulation

Author: Unchitta Kanjanasaratool

This long, technical blog post describes the process of implementing an “opinion dynamics model” (about how two agents will influence each others opinions) in Julia. The author comes from a Python background herself, so I particularly appreciated her callouts of Julia-isms like:

  • multiple dispatch, which means classes don’t have methods (?)
  • where you need types (not everywhere?)
  • what is or isn’t mutable (a struct might be immutable, but its members could still be mutable)
  • putting a ! after functions to note that they have side ffects
  • and what their decorator-like constructs do (@inbounds can skip checking for an array out of bounds if you know it will always be in bounds)

This was really good! It’s clear that this post was written for people with backgrounds similar to me. I felt like the code examples and explanations were at the right level of not being too boring or introductory but not being totally overwhelming, either.

Sidenote: it’s pure chance that I came across two Julia posts in one week, but I’m here for it. It seems like a great language! I do think I should read some tutorials before diving into these nontrivial examples, though. Oops!


Some other Julia articles:


Articles on Roam Research, which I’m considering adopting:


And articles on PhD programs: