Skip to content

Visualization of PyCaffe Custom Metrics

This topic shows you how to set experiment custom metrics and their effects. The topic builds on Getting Started for PyCaffe with Solve.

The following steps are covered:

  • Create a custom metric function.
  • Set the custom metric function to be evaluated and monitored by MissingLink.

Preparation

Compare the base script with the resulting script.

Write code

  1. Create a custom metric function:

    Right above solver.solve(), create a custom metric function:

    def sorensen_dice():
        # Here we can modify this function to
        # calculate the sorensen dice coefficient
        # or any other custom metrics
        # instead of returning 1
        return 1
    
    solver.solve()
    
  2. Set custom metrics for an experiment to be monitored:

    In the base script, right above solver.solve(), add the following fragment to tell the callback to track the custom metric:

    missinglink_callback.set_monitored_blobs(
        ['loss', sorensen_dice])
    
    solver.solve()
    


You should have added custom metrics to your experiment successfully.

  • Inspect the resulting script.
  • Run the new script and see how the MissingLink dashboard helps with monitoring the experiment. A description follows.

Viewing the new functionality on the dashboard

You can see the custom metrics across different experiments on your MissingLink dashboard.