Custom Metrics

You can write your own custom metrics to be calculated and stored for later use within the Metrics Dashboard.

Tensorleap stores metrics and metadata for every sample. This allows the user to investigate certain populations within the dataset. This also means that the custom metric is calculated per prediction on a single sample.

Example of usage:

def custom_metric_mean_distance(y_true, y_pred):
    rank = len(y_true.shape)
    axis = range(1, rank)
    diff = y_true - y_pred
    return tf.reduce_mean(diff, axis=axis)

leap_binder.add_custom_metric(custom_metric_mean_distance, "mean distance")

Once this metric is parsed within the dataset script, it should be added to the model as a block.

This is done by:

  1. right clicking on the Network view,

  2. choosing Metric

  3. Selecting the required Metric from the Node Details menu

  4. Connecting the metric to the relevant blocks.

Last updated