Deploy a Model

cancel
Showing results for 
Search instead for 
Did you mean: 


Deploy a Model

When you deploy a model, it creates an endpoint for the model you want to deploy. You can send new data to this deployment/endpoint and get predictions from that model. You can achieve this with a curl command from the REST API or using our Python SDK.

Deploying your model allows you to easily apply your models to new data. You can also monitor things like service health, accuracy, and data drift using a deployment. You must have a completed model in order to deploy one. You can also deploy a model in the GUI (see the in-app documentation on Deployments for more information).

You can learn how to use this deployment to make predictions here. You can find our full Python Client documentation here.

You can get the sample code for this workflow and snippets in DataRobot Community GitHub.

Deploy a model with REST API

Requirements

  • api_key—found in your profile in the platform
  • A completed model—either built by you or someone else (learn here)
  • modelId—you can find this in the URL of the model (second number)
  • defaultPredictionServerId—you can learn how to do this here


Terminal Request

(cURL sample)

 

curl -v \
-X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
--data "{\"modelId\": \"$MODEL_ID\", \"defaultPredictionServerId\": \"$PREDICTION_SERVER_ID\", \"description\": \"...\", \"label\": \"...\"}" \
https://app.datarobot.com/api/v2/deployments/fromLearningModel/

 

Terminal Response

deploymentId - you can use this to refer to this specific deployment.

Example Request

 

API_KEY=YOUR_API_KEY
MODEL_ID=YOUR_MODEL_ID
PRED_SERVER_ID=YOUR_PREDICTION_SERVER_ID
ENDPOINT=YOUR_DR_URL/api/v2/deployments/fromLearningModel/
curl -v \
-X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
--data "{\"modelId\": \"$MODEL_ID\", \"defaultPredictionServerId\": \"$PREDICTION_SERVER_ID\", \"description\": \"A description\", \"label\": \"A label\"}" \
$ENDPOINT

 

Example Response

 

{"id": "abcdef1234567890"}

 

Deploy a Model with Python

Requirements

  • API Key—profile in the platform
  • Import DataRobot Package and be connected to DataRobot (learn here)
  • A completed model—either built by you or someone else (learn here)
  • The model ID—you can find this in the URL of the model (second number)
    For example:
    app.datarobot.com/projects/54fd7e51426479da/models/<modelId>blueprint
  • The prediction server ID—you can learn how to do this here

Code

(Python sample)

 

dr.Deployment.create_from_learning_model(
    model_id,
    label,
    description=None,
    default_prediction_server_id=None,)

 

Example

 

deployment = dr.Deployment.create_from_learning_model(
      model_id = ‘1d102du0zd22e2d122u09s’, 
      label='New Deployment', 
      description='A new deployment',
      default_prediction_server_id="5a22dza0fbd723001a2f70d9")

 

Labels (3)
Version history
Last update:
‎04-24-2020 03:05 PM
Updated by:
Contributors