YUFENG GUO: In this episode of Cloud AI Adventurers,
find out how to use TensorBoard to visualize your model
and debug problems.
Debugging problems is a lot easier
when you can see what the problem is.
But with gigs of training data feeding into a complex model,
that can get complicated.
Thankfully, TensorBoard makes this a lot easier.
Unlike traditional programming, machine learning
can be very unpredictable.
The quality of your data, along with the nuances of your model,
including the many parameters that must be chosen,
all have wide ranging influences on the success or failure
of the training process.
If only there was some way to track some of these metrics
through the training process, and also
look at the structure of the model that we created,
that would enable us to tune the model and debug
problems that we see.
Now, this abstract process can be difficult to visualize.
But luckily, TensorFlow has a built in solution.
Meet TensorBoard, TensorFlow's built
in visualizer, which enables you to do a wide range of things,
from seeing your model structure to watching your training
progress.
TensorFlow uses the idea of computational graphs
under the hood.
This means that instead of adding
two numbers in the traditional sense,
it constructs an add operator and passes in as inputs
the values being added together.
So when we think about TensorFlow training your model,
it's really executing everything as part of its graph.
TensorBoard can visualize these models,
so you can see what they look like and, more importantly,
ensure that you've wired all the pieces of the way you wanted
to.
Here's an example of a more complex version
of a model graph being visualized by TensorFlow.
Notice how TensorFlow allows us to zoom, pan, and expand
elements to see more details.
This means that we can look at the model
at different layers of abstraction, which can help
reduce the visual complexity.
Moreover, TensorBoard does more than just
show the model structure.
It can also plot the progression of metrics on a nice graph.
Typically, we might plot things like accuracy, loss, cross
entropy.
And depending on the model, different metrics
can be important for you.
And TensorFlow's Candice emitters,
they come with a set of values pre-configured
to be shown in TensorBoard.
So that serves as a great starting point.
TensorBoard can display also a wide variety
of other information, including histograms, distributions,
embeddings, as well as the audio, pictures,
and text data that goes with your model.
But that part's for a future video.
For now, let's take a look at an example
of TensorBoard with the linear model
that we've been using so far.
First, we'll start TensorBoard and point it to the directory
where our model structure and checkpoint files are saved.
This will start a local server on point port 6006.
And yes, that spells out GOOG.
We can see here some of the scalar metrics
that are provided by default with the linear classifier.
We can also expand and zoom into any of these graphs.
Double clicking allows us to zoom back out.
You can see our training progressed nicely
with a decreasing loss over time.
It's also clear that the training hasn't entirely
completed, as the loss is still decreasing at a nice rate,
even at the end of training.
So this might clue us in that perhaps we
could run the training process a bit longer,
and get the most out of this training process.
Let's go over to graphs tab now.
Notice that on the surface, the graph is pretty simple.
We're able to expand each of these blocks
by clicking the plus sign to see more detail.
For example, if I expand the linear block,
we see that it's made up of a number of sub-components.
And we can scroll to zoom in and out,
as well as click and drag to pan and see
other parts of the graph.
Notice also that the names we gave
our future columns, like flower features,
show up as named graph components.
This can help with debugging and identifying
how the graph is all hooked up.
Most of TensorFlow's operations can be named.
So that's a great way to clarify your models
and see what's going on.
Today, we learned that machine learning
is much easier and more fun when you can visualize the model
along with important metrics.
TensorBoard allows you to do this with ease,
and better yet, it's built into TensorFlow.
I'm Yufeng Guo.
And thanks for watching this episode of Cloud AI Adventures.
And remember, next time you need to visualize your machine
learning, use TensorBoard to see what's
happening under the hood.
[MUSIC PLAYING]
If you want more machine learning action,
be sure to subscribe to the channel
to catch future episodes as they come out.
Also, the creators of TensorBoard
gave this excellent talk that the TensorFlow Dev
Summit earlier this year.
Check it out for a more in-depth look at this tool.