Deployment is the central hub for users to deploy, manage and monitor their models.
The following commands can be used to manage deployments.
When creating a new deployment, a DataRobot model_id
and
label
must be provided. A description
can be
optionally provided to document the purpose of the deployment.
The default prediction server is used when making predictions against
the deployment, and is a requirement for creating a deployment on
DataRobot cloud. For on-prem installations, a user must not provide a
default prediction server and a pre-configured prediction server will be
used instead. Refer to ListPredictionServers
for more
information on retrieving available prediction servers.
library(datarobot)
<- GetProject("5506fcd38bd88f5953219da0")
project <- ListModels(project)[[1]]
model <- ListPredictionServers()[[1]]
predictionServer <- CreateDeployment(model,
deployment label = "New Deployment",
description = "A new deployment for demo purposes",
defaultPredictionServerId = predictionServer)
Use the following command to list deployments a user can view.
ListDeployments()
It is possible to retrieve a single deployment with its identifier, rather than list all deployments.
GetDeployment("5e319d2e422fbd6b58a5edad")
To mark a deployment as deleted, use the following command.
<- GetDeployment("5e319d2e422fbd6b58a5edad")
deployment DeleteDeployment(deployment)
The model of a deployment can be replaced effortlessly with zero interruption of predictions.
Model replacement is an asynchronous process, which means there are
some preparatory works to complete before the process is fully finished.
However, predictions made against this deployment will start using the
new model as soon as you initiate the process. The
ReplaceDeployedModel
function won’t return until this
asynchronous process is fully finished.
Alongside the identifier of the new model, a reason
is
also required. The reason is stored in model history of the deployment
for bookkeeping purpose. An enum ModelReplacementReason
is
provided for convenience, all possible values are documented below:
Here is an example of model replacement:
<- GetProject("5506fcd38bd88f5953219da0")
project <- ListModels(project)[[2]]
newModel <- GetDeployment("5e319d2e422fbd6b58a5edad")
deployment ReplaceDeployedModel(deployment, newModel, ModelReplacementReason$Accuracy)
Before initiating the model replacement request, it is usually a good
idea to use the ValidateReplaceDeployedModel
function to
validate if the new model can be used as a replacement.
The ValidateReplaceDeployedModel
function returns the
validation status, a message and a list with details on each check. If
the status is “passing” or “warning”, use
ReplaceDeployedModel
to perform model the replacement. If
status is “failing”, refer to the checks
list for more
details on why the new model cannot be used as a replacement.
<- GetProject("5506fcd38bd88f5953219da0")
project <- ListModels(project)[[2]]
newModel <- GetDeployment("5e319d2e422fbd6b58a5edad")
deployment <- ValidateReplaceDeployedModel(deployment, newModel)
validation print(validation$status) # Look here to see if passing
print(validation$checks) # Look here if not passing to see why
Drift tracking is used to help analyze and monitor the performance of a model after it is deployed. When the model of a deployment is replaced drift tracking status will not be altered.
Use GetDeploymentDriftTrackingSettings
to retrieve the
current tracking status for target drift and feature drift:
<- GetDeployment("5e319d2e422fbd6b58a5edad")
deployment GetDeploymentDriftTrackingSettings(deployment)
Use UpdateDeploymentDriftTrackingSettings
to update
target drift and feature drift tracking status.
<- GetDeployment("5e319d2e422fbd6b58a5edad")
deployment UpdateDeploymentDriftTrackingSettings(deployment, targetDriftEnabled = TRUE)