I am a heavy user of Tensorboard.
However, there were many instances where I had to do custom visualizations.
I used to visualize on notebooks
with matplotlib
.
Recently we came across Altair. It's a Python API to create Vega schema for visualizations, and Vega renders interactive charts with d3.
We are thinking of completely switching over to Altair + Notebooks. The two main questions are:
from lab.analytics import Analyzer
# a = Analyzer('mnist_loop', '9070f0ba756511ea8c99acde48001122')
a = Analyzer('mnist_loop', '1d3f855874d811eabb9359457a24edc8')
Histograms, Scalars = a.get_indicators('Histogram', 'Scalar')
# print(dir(Scalars))
# print(dir(Histograms))
We can use EventAccumulator to extract data from Tensorboard.
a.tb.load()
I mostly use Tensorboard's Scalars and Distributions tabs.
Scalars can be easily replicated on a notebook.
a.tb.render_scalar_simple(Scalars.train_loss, points=None).interactive()
Here's a smoothed out version, with variance bands, which I tend to prefer.
a.tb.render_scalar_simple(Scalars.train_loss).interactive()
The one I use is smoothed out with a view finder. It is so much easier to zoom and go into details of a chart with it.
a.tb.render_scalar(Scalars.train_loss)
Histograms can also be visualized on a notebook just like with Tensorboard. And you can zoom into them, which you can not do on Tensorboard. You can also have a view finder.
a.tb.render_histogram(Histograms.model_conv1_weight_grad)
The best thing about visualizing on notebooks is that you can customize. For instance, here's two histograms laid on top of each other. Not a very useful visualization here, but you get the point.
a.tb.render_histogram_multiple([Histograms.model_fc1_weight_grad, Histograms.model_conv1_weight_grad])
So the visualizations on notebooks are clearly better. What about the ease of use. Tensorboard is definety easier to use. But visualizing with a single line of code isn't so bad.
We haven't used this extensively yet. And we plan on have simple helper functions to create most of the frequently needed visualizations. Like may be a single function to render a collection of charts for all scalars.
Today, we open sourced the code on lab/analytics. And this notebook is available on lab/samples.
This notebook assumes your project was using 🧪 lab.
However, you can directly connect to any Tensorboard log directory
using AltairTensorBoardAnalytics
found in lab/analytics/altair/tb.py.
If you have any suggestions or comments, please let us know on twitter/vpj or Slack. Thanks.