Building Interactive REPL-based Visualizations in GridWorlds.jl
07-28, 19:40–19:50 (UTC), Purple

Visualization often plays an important role in several disciplines. For example, in reinforcement learning, visualization tools are indispensable for testing environment logic and analyzing agent behavior. Using the GridWorlds.jl package as an example, I will explain some fundamental concepts and techniques to enable anyone to easily build their own terminal-based visualizations from scratch, and demonstrate how they can be leveraged to create productive workflows inside the Julia REPL.


Resources:
Repository for this talk: https://github.com/Sid-Bhatia-0/JuliaCon2021Talk
GridWorlds.jl: https://github.com/JuliaReinforcementLearning/GridWorlds.jl

A good visualization can sometimes drastically speed up the understanding of a program. Plots are an obvious example of this. Additionally, in reinforcement learning, for example, other forms of visualizations are often used to test out an environment, and also to analyze the behavior of an agent in the environment at various points during its training process.

While developing complex programs, it often pays off well to write visualization tools from an early stage, especially when the correctness of a program cannot be verified via writing test cases alone. Reinforcement learning environments, or any kinds of games for that matter, are a good example of this. In many cases, people may overestimate the cost of creating such tools relative to the value they provide, and might perceive such a task to be more challenging than it actually is. I am here to show you that in some cases, it is much easier than you might think.

The Julia REPL offers several valuable features, often making it an indispensable part of a Julia user’s workflow in some form or another. It is possible to take this one step further and create interactive terminal-based visualizations that unlock even more productive workflows while using the REPL.

I will showcase some relevant features from the GridWorlds.jl package as a concrete example of increased developer productivity using interactive terminal-based visualizations in the REPL. In this package, plain keyboard inputs allow one to rapidly test and debug tile-based reinforcement learning environments by directly visualizing and playing them inside the terminal. One can instantly switch back and forth between testing an environment and debugging it in the REPL in the same REPL session without losing the local state. Additionally, one can also record these interactions and replay them inside the REPL by stepping through the individual frames. This feature also proves extremely handy when analyzing the behavior of an agent at various points during training.

I will deconstruct the essential pieces necessary to create and run such a visualization inside the terminal and explain how it can be built from scratch, only utilizing things that already ship with Julia.

The techniques and tricks explained in this talk are much more generally applicable. I encourage everyone to think about how you can creatively augment your current workflow to make it even more productive and engaging for your domain.