Skip to content

Integration with a Keras Neural Network

This topic shows you how to integrate the MissingLink SDK with a Keras convolutional neural network that is trained on the MNIST dataset.

The following steps are covered:

  • Define a project callback with your credentials.
  • Create a new experiment.
  • Give the experiment a name and description.
  • Pass the callback to Keras.
  • Add a test scope.


You can also consider trying the step-by-step tutorial for integrating the MissingLink SDK with an existing Keras example.


  • You must have Keras installed in the same working environment that MissingLink SDK is installed. The SDK doesn't enforce Keras as one of its dependencies.

  • You must have created a new project and have its credentials: owner_id and project_token ready. Otherwise, follow the instructions in Creating a project.


Ensure that you can successfully run the basic training script. In the steps that follow below, the basic script is integrated with the MissingLink SDK to enable remote monitoring of the training, validation, and testing process.

Compare the basic script with the integrated script.

Write code

  1. Import the SDK and define your credentials at the beginning of the file (before any function definition).

    import missinglink
    OWNER_ID = 'Your owner id'
    PROJECT_TOKEN = 'Your project token'
  2. Now you can create a KerasCallback instance with your credentials, which helps to monitor the experiment in real time. Right before the function, add the following statements:

    missinglink_callback = missinglink.KerasCallback(
      owner_id=OWNER_ID, project_token=PROJECT_TOKEN)
  3. Give the experiment a name and description. Add the following right after creating the callback:

      display_name='Keras neural network',
      description='Two dimensional convolutional neural network')
  4. Next, pass the callback that you just created to Keras. Modify the function to the following statement:
      x_train, y_train, batch_size=BATCH_SIZE,
      nb_epoch=EPOCHS, validation_split=VALIDATION_SPLIT,


    At this point, you have performed the train and validation stages of running the experiment. Running the test stage is optional and can be done in the next step:

  5. To add a test scope, replace the evaluation with MissingLink's test scope and evaluate the model as usual within the test scope as detailed below.

     with missinglink_callback.test(model):
     score = model.evaluate(x_test, y_test)

You should have integrated MissingLink's SDK successfully.

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

Web dashboard monitoring

You can monitor your experiment on your MissingLink dashboard.

Click on the experiment to view your metric graphs.

Next steps

Learn more about integrating with Keras to enable the following MissingLink features: