Using the API

This article describes how to deploy a DataRobot model as a REST API, make predictions using that deployment, and set up the deployment to track model accuracy.

DataRobot enables you to deploy a model and make predictions against it using a REST API. This is advantageous in the following ways:

  • Model management features such as data drift detection, accuracy monitoring, and service health summary are all accessible for this deployment.
  • Minimal programming skills are needed to interact with the deployment when using the REST API resulting in minimum contact with the IT and/or software engineering department.

Here are the steps for deploying a model from the Leaderboard tab:

  1. Select the desired model from the Leaderboard and click Predict > Deploy tab (Figure 1). Then click the Add new deployment button (Figure 2).
  2. This will open a form that allows you to specify the name of the deployment, the description of the deployment, the endpoint of the prediction servers, and some other settings like the prediction threshold and data drift (See Figure 3).
    1. It is good practice to enable the Enable data drift tracking option at this stage.
  3. Click the Deploy Model button and DataRobot will instantly deploy this model.

Figure 1. The Deploy tab of a specific model on the LeaderboardFigure 1. The Deploy tab of a specific model on the Leaderboard

Figure 2. Select Add new deploymentFigure 2. Select Add new deployment

Figure 3. Deployment optionsFigure 3. Deployment options

 After the model is deployed, DataRobot shows a pop-up window enabling you to view it in the Deployments tab. Click Open Deployment (Figure 4) in that window. 

Figure 4: View the deployment in the Deployments tabFigure 4: View the deployment in the Deployments tab

From the Deployments tab, you have access to a number of advanced model management capabilities such as service health summary (Figure 5), data drift detection (Figure 6), and accuracy monitoring (Figure 7).

Figure 5. Service Health tab for the readmitted Predictions deploymentFigure 5. Service Health tab for the readmitted Predictions deployment

Figure 6. Data Drift tab for the readmitted Predictions deploymentFigure 6. Data Drift tab for the readmitted Predictions deployment


Figure 7. Accuracy tab for the readmitted Predictions deploymentFigure 7. Accuracy tab for the readmitted Predictions deployment

Even with only minimal programming experience, you can make predictions against any deployment in the Deployments tab by cutting and pasting the sample

Python code provided in the Integrations tab (Figure 8). While in that tab, you can also select the following:

  • Perform single or batch predictions.
  • Set the input file format as either CSV or JSON.
  • Require the API to return prediction explanations.


Figure 8. Integrations tab with a Python script for making API calls against this deploymentFigure 8. Integrations tab with a Python script for making API calls against this deployment

In addition to making predictions against this deployment, you might also be interested in monitoring its accuracy. This can be done by uploading the actual values of the records that you used to make predictions. DataRobot will need to know the association id for each record (i.e., the variable that represents the record’s unique id) before it can begin to display model accuracy. In order to do this, navigate to the Settings > Data tab and enable Require association ID in prediction requests (in the Association ID section). Type the association ID and save it. (Figure 9).

Figure 9. Setting the Association ID for tracking the accuracy of a modelFigure 9. Setting the Association ID for tracking the accuracy of a model

Now each time DataRobot returns the actual values for a prediction, they should be uploaded to the deployment so DataRobot can track the accuracy of this model over time. To set up a procedure to do this automatically, while still in the Settings > Data tab, click the Add Data button (in the Actuals section).

More Information

If you’re a licensed DataRobot customer, search the in-app documentation for How to: Prediction API.

Version history
Revision #:
16 of 16
Last update:
a week ago
Updated by:
 
Contributors