Keras Tuner

Integrate Trains into code that uses Keras Tuner. By specifying TrainsTunerLogger (see kerastuner.py) as the Keras Tuner logger, Trains automatically logs scalars and hyperparameter optimization.

TrainsTunerLogger

The TrainsTunerLogger class provides the required binding for Trains automatic logging. Instantiate a TrainsTunerLogger object and assign it as the logger for a Keras Tuner tuner.

This is demonstrated in the keras_tuner_cifar.py example, which uses Keras Tuner's Hyperband tuner. It finds the best hyperparameters to train a network on a CIFAR10 dataset.

When the Hyperband object is created, instantiate a TrainsTunerLogger object and assign it to the Hyperband logger.

tuner = kt.Hyperband(
    build_model,
    project_name='kt examples',
    logger=TrainsTunerLogger(),
    objective='val_accuracy',
    max_epochs=10,
    hyperband_iterations=6)

When the script runs, it logs a tabular summary of hyperparameters tested and their metrics by trial Id, and a scalar plot showing metrics for all runs, and summary plot, as well as the output model with its configuration and snapshot location.

Scalars

Trains logs the scalars from training each network. They appear in RESULTS > SCALARS.

image

Summary of hyperparameter optimization

Trains automatically logs the parameters of each experiment run in the hyperparameter search. They appear in tabular form in RESULTS > PLOTS.

image

Artifacts

Trains automatically stores the output model. It appears in ARTIFACTS > Output Model.

image

Model details include snap locations. Model details appear in the MODELS tab.

image

The model configuration is stored with the model.

image

Configuration objects

Hyperparameters

Trains automatically logs the TensorFlow DEFINEs. Trains automatically logs the TensorFlow DEFINEs. They appear in RESULTS > CONFIGURATION > HYPER PARAMETERS.

image

Configuration

The Task configuration appears in RESULTS > CONFIGURATION > General.

image