Keras with Matplotlib - Jupyter Notebook
Trains is now ClearML
This documentation applies to the legacy Trains versions. For the latest documentation, see ClearML.
The jupyter.ipynb example demonstrates Trains automatic logging of code running in a Jupyter Notebook that uses Keras and Matplotlib. It trains a simple deep neural network on the Keras built-in MNIST dataset. It builds a sequential model using a categorical crossentropy loss objective function, specifies accuracy as the metric, and uses two callbacks: a TensorBoard callback and a model checkpoint callback. When the script runs, it creates an experiment named notebook example
which is associated with the examples
project.
Scalars
The loss and accuracy metric scalar plots appear in RESULTS > SCALARS, along with the resource utilization plots, which are titled :monitor: machine.
Plots
The example calls Matplotlib methods to create several sample plots, and TensorBoard methods to plot histograms for layer density. They appear in RESULTS > PLOTS.
Debug samples
Calls to Matplotlib methods log debug sample images. They appear in RESULTS > DEBUG SAMPLES.
Hyperparameters
Trains automatically logs TensorFlow DEFINEs. A parameter dictionary is logged by connecting it to the Task using a call to the Task.connect method.
task_params = {'num_scatter_samples': 60, 'sin_max_value': 20, 'sin_steps': 30}
task_params = task.connect(task_params)
Later in the Juputer Notebook, more parameters are added to the dictionary.
task_params['batch_size'] = 128
task_params['nb_classes'] = 10
task_params['nb_epoch'] = 6
task_params['hidden_dim'] = 512
Parameter dictionaries appear in CONFIGURATIONS > HYPER PARAMETERS > General.
The TensorFlow DEFINES appear in the TF_DEFINE subsection.
Log
Text printed to the console for training appears in RESULTS > LOG.
Artifacts
Model artifacts associated with the experiment appear in the experiment info panel (in the EXPERIMENTS tab), and in the model info panel (in the MODELS tab).
The experiment info panel shows model tracking, including the model name and design in ARTIFACTS > Output Model.
The model info panel contains the model details, including the model URL, framework, and snapshot locations.