Xgboost 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:

Once the model is trained, create a model and deploy it to a hosted endpoint.

xgb_predictor = xgb.deploy(initial_instance_count = 1, instance_type = 'ml.m4.xlarge')

Now that there is a hosted endpoint running, we can make real-time predictions from our model very easily, simply by making an http POST request. But first, we'll need to setup serializers and deserializers for passing our test_data NumPy arrays to the model behind the endpoint.

Predict based on input data

xgb_predictor.content_type = 'text/csv'
xgb_predictor.serializer = csv_serializer
xgb_predictor.deserializer = None
prediction = xgb_predictor.predict(test_data.values[0,1:])

Related content: