DeepAR Inference

Create Endpoint

If you followed the python instructions in this link to train your DeepAR model, deploying your model is as simple as doing:

predictor = estimator.deploy(initial_instance_count=1,instance_type='ml.m4.xlarge')

Otherwise, you can create a model and deploy it as an endpoint using the console.

First go to your training job, and click create model:

Then create an endpoint:

Predict

DeepAR requires the following set up to do a predict:

First, copy existing data from a test file and add any dynamic features:

instance = [{"start": "2013-01-01 00:00:00", "target": [0, 5530, .....], ....}]

Replace the python dict above with your own dict from a test file you generated, or use a line from the train file for demonstration purposes.

Next, Prepare HTTP request data that DeepAR likes:

configuration = {
            "num_samples": 100,
            "output_types": ["quantiles"],
            "quantiles": ['0.25','0.5','0.75']
        }

http_request_data = {
            "instances": instance,
            "configuration": configuration
        }

req = json.dumps(http_request_data).encode('utf-8')

Finally do a predict!

predictor.predict(req)

Learn more about inference formats here.


Related content: