Amazon SageMaker
Developer Guide

Apache MXNet Example 1: Using the Module API

This introductory Apache MXNet example demonstrates using Amazon SageMaker sagemaker.mxnet.MXNet estimator class, provided as part of Amazon SageMaker high-level Python library. It provides the fit method for model training in Amazon SageMaker and deploy method to deploy resulting model in Amazon SageMaker.

In this exercise, you construct a neural network classifier using the Apache MXNet Module API. You then train the model using the The MNIST Database dataset, which Amazon SageMaker provides in an S3 bucket.

In this example, you do the following

  1. Train the model. During training, the following occurs:

    1. Amazon SageMaker loads the Docker image containing the Apache MXNet framework.

    2. Amazon SageMaker reads training data from the S3 bucket into the container's file system.

    3. Your custom training code constructs a neural network classifier (using the mxnet.module.Module class).

    4. The Amazon SageMaker code in the container runs training. Your training code reads the training data for model training.

  2. Deploy the model using Amazon SageMaker hosting services. Amazon SageMaker returns an endpoint that you send requests to to get inferences.

  3. Test the model. The example provides an HTML canvas in the notebook where you can write a single-digit number using your mouse. The image of the number is then sent to the model for inference.