Main Content


Group metrics in experiment training plot



    groupSubPlot(monitor,title,metricNames) groups the specified metrics in a single training subplot with the title title. By default, Experiment Manager plots each ungrouped metric in its own training subplot.


    collapse all

    Use an experiments.Monitor object to track the progress of the training, display information and metric values in the experiment results table, and produce training plots for custom training experiments.

    Before starting the training, specify the names of the information and metric columns of the Experiment Manager results table.

    monitor.Info = ["GradientDecayFactor","SquaredGradientDecayFactor"];
    monitor.Metrics = ["TrainingLoss","ValidationLoss"];

    Specify the horizontal axis label for the training plot. Group the training and validation loss in the same subplot.

    monitor.XLabel = "Iteration";

    Update the values of the gradient decay factor and the squared gradient decay factor for the trial in the results table.

    updateInfo(monitor, ...
        'GradientDecayFactor',gradientDecayFactor, ...

    After each iteration of the custom training loop, record the value of training and validation loss for the trial in the results table and the training plot.

    recordMetrics(monitor,iteration, ...
        'TrainingLoss',trainingLoss, ...

    Update the training progress for the trial based on the fraction of iterations completed.

    monitor.Progress = (iteration/numIterations) * 100;

    Input Arguments

    collapse all

    Experiment monitor for the trial, specified as an experiments.Monitor object. When you run a custom training experiment, Experiment Manager passes this object as the second input argument of the training function.

    Title of the training subplot, specified as a string or character vector.

    Data Types: char | string

    Metric names, specified as a string, character vector, string array, or cell array of character vectors. Each metric name must be an element of the Metrics property of the experiments.Monitor object monitor.

    Data Types: char | string


    • Use the groupSubplot function to define your training subplots before calling the function recordMetrics.

    Introduced in R2021a