Skip to content

Deployment Management

Deployments

Deployment

class datarobot.models.Deployment

A deployment created from a DataRobot model.

Variables

Attribute Type Description
id str the ID of the deployment
label str the label of the deployment
description str the description of the deployment
status str (New in version v2.29) deployment status
default_prediction_server dict Information about the default prediction server for the deployment. Accepts the following keys: id (str) — Prediction server ID;
url Optional[str] Prediction server URL; datarobot-key (str) — Corresponds to the PredictionServer snake_cased datarobot_key parameter that allows you to verify and access the prediction server.
importance Optional[str] deployment importance
model dict information on the model of the deployment
model_package dict (New in version v3.4) information on the model package of the deployment
prediction_usage dict information on the prediction usage of the deployment
permissions list (New in version v2.18) user’s permissions on the deployment
service_health dict information on the service health of the deployment
model_health dict information on the model health of the deployment
accuracy_health dict information on the accuracy health of the deployment
fairness_health dict information on the fairness health of a deployment
governance dict information on approval and change requests of a deployment
owners dict information on the owners of a deployment
prediction_environment dict information on the prediction environment of a deployment
creator dict information about the creator of a deployment
tags list[dict[str,str]] Information about the deployment’s tags.

create_from_learning_model()

classmethod create_from_learning_model()

Create a deployment from a DataRobot model.

Added in version v2.17.

Parameters

Parameter Type Description
model_id str id of the DataRobot model to deploy
label str a human-readable label of the deployment
description Optional[str] a human-readable description of the deployment
default_prediction_server_id Optional[str] an identifier of a prediction server to be used as the default prediction server
importance Optional[str] deployment importance
prediction_threshold Optional[float] threshold used for binary classification in predictions
status Optional[str] deployment status
max_wait Optional[int] Seconds to wait for successful resolution of a deployment creation job. Deployment supports making predictions only after a deployment creating job has successfully finished.

Returns

Returns Description
deployment The created deployment

Return type: Deployment

Examples

from datarobot import Project, Deployment
project = Project.get('5506fcd38bd88f5953219da0')
model = project.get_models()[0]
deployment = Deployment.create_from_learning_model(model.id, 'New Deployment')
deployment
>>> Deployment('New Deployment')

create_from_leaderboard()

classmethod create_from_leaderboard()

Create a deployment from a Leaderboard.

Added in version v2.17.

Parameters

Parameter Type Description
model_id str id of the Leaderboard to deploy
label str a human-readable label of the deployment
description Optional[str] a human-readable description of the deployment
default_prediction_server_id Optional[str] an identifier of a prediction server to be used as the default prediction server
importance Optional[str] deployment importance
prediction_threshold Optional[float] threshold used for binary classification in predictions
status Optional[str] deployment status
max_wait Optional[int] The amount of seconds to wait for successful resolution of a deployment creation job. Deployment supports making predictions only after a deployment creating job has successfully finished.

Returns

Returns Description
deployment The created deployment

Return type: Deployment

Examples

from datarobot import Project, Deployment
project = Project.get('5506fcd38bd88f5953219da0')
model = project.get_models()[0]
deployment = Deployment.create_from_leaderboard(model.id, 'New Deployment')
deployment
>>> Deployment('New Deployment')

create_from_custom_model_version()

classmethod create_from_custom_model_version()

Create a deployment from a DataRobot custom model image.

Parameters

Parameter Type Description
custom_model_version_id str The ID of the DataRobot custom model version to deploy. The version must have a base_environment_id.
label str A label of the deployment.
description Optional[str] A description of the deployment.
default_prediction_server_id str An identifier of a prediction server to be used as the default prediction server. Required for SaaS users and optional for Self-Managed users.
max_wait Optional[int] Seconds to wait for successful resolution of a deployment creation job. Deployment supports making predictions only after a deployment creating job has successfully finished.
importance Optional[str] Deployment importance level.

Returns

Returns Description
deployment The created deployment

Return type: Deployment

create_from_registered_model_version()

classmethod create_from_registered_model_version()

Create a deployment from a DataRobot model package (version).

Parameters

Parameter Type Description
model_package_id str The ID of the DataRobot model package (also known as a registered model version) to deploy.
label str A human readable label of the deployment.
description Optional[str] A human readable description of the deployment.
default_prediction_server_id Optional[str] an identifier of a prediction server to be used as the default prediction server When working with prediction environments, default prediction server Id should not be provided
prediction_environment_id Optional[str] An identifier of a prediction environment to be used for model deployment.
importance Optional[str] Deployment importance level.
user_provided_id Optional[str] A user-provided unique ID associated with a deployment definition in a remote git repository.
additional_metadata list[dict], optional List of key/value dictionaries with additional metadata. For example, [{“key”: “Department”, “value”: “Engineering”}, {“key”: “Location”, “value”: “Boston”}]
max_wait Optional[int] The amount of seconds to wait for successful resolution of a deployment creation job. Deployment supports making predictions only after a deployment creating job has successfully finished.

Returns

Returns Description
deployment The created deployment

Return type: Deployment

list()

classmethod list()

List all deployments a user can view.

Added in version v2.17.

Parameters

Parameter Type Description
order_by Optional[str] (New in version v2.18) the order to sort the deployment list by, defaults to label Allowed attributes to sort by are:- label - serviceHealth - modelHealth - accuracyHealth - recentPredictions - lastPredictionTimestamp If the sort attribute is preceded by a hyphen, deployments will be sorted in descending order, otherwise in ascending order. For health related sorting, ascending means failing, warning, passing, unknown.
search Optional[str] (New in version v2.18) case insensitive search against deployment’s label and description.
filters Optional[datarobot.models.deployment.DeploymentListFilters] (New in version v2.20) an object containing all filters that you’d like to apply to the resulting list of deployments. See DeploymentListFilters for details on usage.
offset Optional[int] The starting offset of the results. The default is 0.
limit Optional[int] The maximum number of objects to return. The default is 0 to maintain previous behavior. The default on the server is 20, with a maximum of 100.

Returns

Returns Description
deployments a list of deployments the user can view

Return type: list

Examples

from datarobot import Deployment
deployments = Deployment.list()
deployments
>>> [Deployment('New Deployment'), Deployment('Previous Deployment')]
from datarobot import Deployment
from datarobot.enums import DEPLOYMENT_SERVICE_HEALTH_STATUS
filters = DeploymentListFilters(
    role='OWNER',
    service_health=[DEPLOYMENT_SERVICE_HEALTH.FAILING]
)
filtered_deployments = Deployment.list(filters=filters)
filtered_deployments
>>> [Deployment('Deployment I Own w/ Failing Service Health')]

get()

classmethod get()

Get information about a deployment.

Added in version v2.17.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment

Returns

Returns Description
deployment the queried deployment

Return type: Deployment

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.id
>>>'5c939e08962d741e34f609f0'
deployment.label
>>>'New Deployment'

predict_batch()

method predict_batch()

A convenience method for making predictions with csv file or pandas DataFrame using a batch prediction job.

For advanced usage, use datarobot.models.BatchPredictionJob directly.

Added in version v3.0.

Parameters

Parameter Type Description
source str, pd.DataFrame or file object Pass a filepath, file, or DataFrame for making batch predictions.
passthrough_columns Optional[List[str]] Keep these columns from the scoring dataset in the scored dataset. This is useful for correlating predictions with source data.
download_timeout Optional[int] Wait this many seconds for the download to become available. See datarobot.models.BatchPredictionJob.score().
download_read_timeout Optional[int] Wait this many seconds for the server to respond between chunks. See datarobot.models.BatchPredictionJob.score().
upload_read_timeout Optional[int] Wait this many seconds for the server to respond after a whole dataset upload. See datarobot.models.BatchPredictionJob.score().

Returns

Returns Description
Prediction results in a pandas DataFrame.

Return type: pd.DataFrame

Raises

Exception Description
InvalidUsageError If the source parameter cannot be determined to be a filepath, file, or DataFrame.

Examples

from datarobot.models.deployment import Deployment

deployment = Deployment.get("<MY_DEPLOYMENT_ID>")
prediction_results_as_dataframe = deployment.predict_batch(
    source="./my_local_file.csv",
)

get_uri()

method get_uri()

Returns

Returns Description
url Deployment’s overview URI

Return type: str

update()

method update()

Update the label and description of this deployment.

Added in version v2.19.

Return type: None

delete()

method delete()

Delete this deployment.

Added in version v2.17.

Return type: None

activate()

method activate()

Activates this deployment. When succeeded, deployment status become active.

Added in version v2.29.

Parameters

Parameter Type Description
max_wait Optional[int] The maximum time to wait for deployment activation to complete before erroring

Return type: None

deactivate()

method deactivate()

Deactivates this deployment. When succeeded, deployment status become inactive.

Added in version v2.29.

Parameters

Parameter Type Description
max_wait Optional[int] The maximum time to wait for deployment deactivation to complete before erroring

Return type: None

replace_model()

method replace_model()

Replace the model used in this deployment. To confirm model replacement eligibility, use : validate_replacement_model() beforehand.

Added in version v2.17.

Model replacement is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

Predictions made against this deployment will start using the new model as soon as the request is completed. There will be no interruption for predictions throughout the process.

Parameters

Parameter Type Description
new_model_id Optional[str] The id of the new model to use. If replacing the deployment’s model with a CustomInferenceModel, a specific CustomModelVersion ID must be used. If None, new_registered_model_version_id must be specified.
reason MODEL_REPLACEMENT_REASON The reason for the model replacement. Must be one of ‘ACCURACY’, ‘DATA_DRIFT’, ‘ERRORS’, ‘SCHEDULED_REFRESH’, ‘SCORING_SPEED’, or ‘OTHER’. This value will be stored in the model history to keep track of why a model was replaced
max_wait Optional[int] (new in version 2.22) The maximum time to wait for model replacement job to complete before erroring
new_registered_model_version_id Optional[str] (new in version 3.4) The registered model version (model package) ID of the new model to use. Must be passed if new_model_id is None.

Return type: None

Examples

from datarobot import Deployment
from datarobot.enums import MODEL_REPLACEMENT_REASON
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.model['id'], deployment.model['type']
>>>('5c0a979859b00004ba52e431', 'Decision Tree Classifier (Gini)')

deployment.replace_model('5c0a969859b00004ba52e41b', MODEL_REPLACEMENT_REASON.ACCURACY)
deployment.model['id'], deployment.model['type']
>>>('5c0a969859b00004ba52e41b', 'Support Vector Classifier (Linear Kernel)')

perform_model_replace()

method perform_model_replace()

Replace the model used in this deployment. To confirm model replacement eligibility, use : validate_replacement_model() beforehand.

Added in version v3.4.

Model replacement is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

Predictions made against this deployment will start using the new model as soon as the request is completed. There will be no interruption for predictions throughout the process.

Parameters

Parameter Type Description
new_registered_model_version_id str The registered model version (model package) ID of the new model to use.
reason MODEL_REPLACEMENT_REASON The reason for the model replacement. Must be one of ‘ACCURACY’, ‘DATA_DRIFT’, ‘ERRORS’, ‘SCHEDULED_REFRESH’, ‘SCORING_SPEED’, or ‘OTHER’. This value will be stored in the model history to keep track of why a model was replaced
max_wait Optional[int] The maximum time to wait for model replacement job to complete before erroring

Return type: None

Examples

from datarobot import Deployment
from datarobot.enums import MODEL_REPLACEMENT_REASON
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.model_package['id']
>>>'5c0a979859b00004ba52e431'

deployment.perform_model_replace('5c0a969859b00004ba52e41b', MODEL_REPLACEMENT_REASON.ACCURACY)
deployment.model_package['id']
>>>'5c0a969859b00004ba52e41b'

validate_replacement_model()

method validate_replacement_model()

Validate a model can be used as the replacement model of the deployment.

Added in version v2.17.

Parameters

Parameter Type Description
new_model_id Optional[str] the ID of the new model to validate
new_registered_model_version_id Optional[str] (new in version 3.4) The registered model version (model package) ID of the new model to use.

Return type: Tuple[str, str, Dict[str, Any]]

Returns

Returns Description
status (str) status of the validation, will be one of ‘passing’, ‘warning’ or ‘failing’. If the status is passing or warning, use replace_model() to perform a model replacement. If the status is failing, refer to checks for more detail on why the new model cannot be used as a replacement.
message (str) message for the validation result
checks (dict) explain why the new model can or cannot replace the deployment’s current model

get_features()

method get_features()

Retrieve the list of features needed to make predictions on this deployment.

Notes

Each feature dict contains the following structure:

  • name : str, feature name
  • feature_type : str, feature type
  • importance : float, numeric measure of the relationship strength between the feature and target (independent of model or other features)
  • date_format : str or None, the date format string for how this feature was interpreted, null if not a date feature, compatible with https://docs.python.org/2/library/time.html#time.strftime.
  • known_in_advance : bool, whether the feature was selected as known in advance in a time series model, false for non-time series models.

Returns

Returns Description
features a list of feature dict

Return type: list

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
features = deployment.get_features()
features[0]['feature_type']
>>>'Categorical'
features[0]['importance']
>>>0.133

submit_actuals()

method submit_actuals()

Submit actuals for processing. The actuals submitted will be used to calculate accuracy metrics.

Parameters

Parameter Type Description
data (list or pandas.DataFrame)
batch_size (the max number of actuals in each request)
list (If data is a)
and (each item should be a dict-like object with the following keys)
pandas.DataFrame (values; if data is a)
columns (it should contain the following)
association_id *-* max length 128 characters
actual_value *-* should be numeric for deployments with regression models or string for deployments with classification model
was_acted_on *-* could have affected the actual outcome
timestamp *-* does not have a timezone, we assume it is UTC.

Raises

Exception Description
ValueError if input data is not a list of dict-like objects or a pandas.DataFrame if input data is empty

Return type: None

Examples

from datarobot import Deployment, AccuracyOverTime
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
data = [{
    'association_id': '439917',
    'actual_value': 'True',
    'was_acted_on': True
}]
deployment.submit_actuals(data)

submit_actuals_from_catalog_async()

method submit_actuals_from_catalog_async()

Submit actuals from AI Catalog for processing. The actuals submitted will be used to calculate accuracy metrics.

Parameters

Parameter Type Description
dataset_id str, The ID of the source dataset.
dataset_version_id Optional[str] The ID of the dataset version to apply the query to. If not specified, the latest version associated with dataset_id is used.
association_id_column str, The name of the column that contains a unique identifier used with a prediction.
actual_value_column str, The name of the column that contains the actual value of a prediction.
was_acted_on_column Optional[str], The name of the column that indicates if the prediction was acted on in a way that could have affected the actual outcome.
timestamp_column Optional[str], The name of the column that contains datetime or string in RFC3339 format.

Returns

Returns Description
status_check_job Object contains all needed logic for a periodical status check of an async job.

Return type: StatusCheckJob

Raises

Exception Description
ValueError if dataset_id not provided if actual_value_column not provided if association_id_column not provided

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
status_check_job = deployment.submit_actuals_from_catalog_async(data)

get_predictions_by_forecast_date_settings()

method get_predictions_by_forecast_date_settings()

Retrieve predictions by forecast date settings of this deployment.

Added in version v2.27.

For time series deployments using the date/time format %Y-%m-%d %H:%M:%S.%f, DataRobot automatically populates a v2 in front of the timestamp format (forecast_date_format). Date/time values submitted in prediction data should not include this v2 prefix. Other timestamp formats are not affected.

Returns

Returns Description
settings Predictions by forecast date settings of the deployment.

Return type: ForecastDateSettings

update_predictions_by_forecast_date_settings()

method update_predictions_by_forecast_date_settings()

Update predictions by forecast date settings of this deployment.

Added in version v2.27.

Updating predictions by forecast date setting is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

For time series deployments using the date/time format %Y-%m-%d %H:%M:%S.%f, DataRobot automatically populates a v2 in front of the timestamp format (forecast_date_format). If you are updating predictions by forecast date settings for a Time Series deployment with date/time format %Y-%m-%d %H:%M:%S.%f, you must add the v2 prefix to your submitted forecast_date_format parameter. Date/time values submitted in prediction data should not include this v2 prefix. Other timestamp formats are not affected.

Examples

# To set predictions by forecast date settings to the same default settings you see when using
# the DataRobot web application, you use your 'Deployment' object like this:
deployment.update_predictions_by_forecast_date_settings(
   enable_predictions_by_forecast_date=True,
   forecast_date_column_name="date (actual)",
   forecast_date_format="%Y-%m-%d",
)

Parameters

Parameter Type Description
enable_predictions_by_forecast_date bool set to True if predictions by forecast date is to be turned on or set to ‘’False’’ if predictions by forecast date is to be turned off.
forecast_date_column_name string, optional The column name in prediction datasets to be used as forecast date. If ‘’enable_predictions_by_forecast_date’’ is set to ‘’False’’, then the parameter will be ignored.
forecast_date_format string, optional The datetime format of the forecast date column in prediction datasets. If ‘’enable_predictions_by_forecast_date’’ is set to ‘’False’’, then the parameter will be ignored.
max_wait Optional[int] seconds to wait for successful

Return type: None

get_challenger_models_settings()

method get_challenger_models_settings()

Retrieve challenger models settings of this deployment.

Added in version v2.27.

Returns

Returns Description
settings

Return type: ChallengerModelsSettings

update_challenger_models_settings()

method update_challenger_models_settings()

Update challenger models settings of this deployment.

Added in version v2.27.

Updating challenger models setting is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

Parameters

Parameter Type Description
challenger_models_enabled bool set to True if challenger models is to be turned on or set to ‘’False’’ if challenger models is to be turned off
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

get_segment_analysis_settings()

method get_segment_analysis_settings()

Retrieve segment analysis settings of this deployment.

Added in version v2.27.

Returns

Returns Description
settings

Return type: SegmentAnalysisSettings

update_segment_analysis_settings()

method update_segment_analysis_settings()

Update segment analysis settings of this deployment.

Added in version v2.27.

Updating segment analysis setting is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

Parameters

Parameter Type Description
segment_analysis_enabled bool set to True if segment analysis is to be turned on or set to ‘’False’’ if segment analysis is to be turned off
segment_analysis_attributes Optional[List] A list of strings that gives the segment attributes selected for tracking.
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

get_bias_and_fairness_settings()

method get_bias_and_fairness_settings()

Retrieve bias and fairness settings of this deployment.

..versionadded:: v3.2.0

Returns

Returns Description
settings

Return type: BiasAndFairnessSettings

update_bias_and_fairness_settings()

method update_bias_and_fairness_settings()

Update bias and fairness settings of this deployment.

..versionadded:: v3.2.0

Updating bias and fairness setting is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

Parameters

Parameter Type Description
protected_features List[str] A list of features to mark as protected.
preferable_target_value bool A target value that should be treated as a positive outcome for the prediction.
fairness_metric_set str Can be one of . The fairness metric used to calculate the fairness scores.
fairness_threshold float Threshold value of the fairness metric. Cannot be less than 0 or greater than 1.
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

get_challenger_replay_settings()

method get_challenger_replay_settings()

Retrieve challenger replay settings of this deployment.

Added in version v3.4.

Returns

Returns Description
settings

Return type: ChallengerReplaySettings

update_challenger_replay_settings()

method update_challenger_replay_settings()

Update challenger replay settings of this deployment.

Added in version v3.4.

Parameters

Parameter Type Description
enabled bool If challenger replay is enabled.
schedule Optional[Schedule] The recurring schedule for the challenger replay job.

Return type: None

get_drift_tracking_settings()

method get_drift_tracking_settings()

Retrieve drift tracking settings of this deployment.

Added in version v2.17.

Returns

Returns Description
settings

Return type: DriftTrackingSettings

update_drift_tracking_settings()

method update_drift_tracking_settings()

Update drift tracking settings of this deployment.

Added in version v2.17.

Updating drift tracking setting is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

Parameters

Parameter Type Description
target_drift_enabled Optional[bool] if target drift tracking is to be turned on
feature_drift_enabled Optional[bool] if feature drift tracking is to be turned on
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

get_association_id_settings()

method get_association_id_settings()

Retrieve association ID setting for this deployment.

Added in version v2.19.

Returns

Returns Description
association_id_settings

Return type: str

update_association_id_settings()

method update_association_id_settings()

Update association ID setting for this deployment.

Added in version v2.19.

Parameters

Parameter Type Description
column_names list[string], optional name of the columns to be used as association ID, currently only support a list of one string
required_in_prediction_requests Optional[bool] whether the association ID column is required in prediction requests
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

get_predictions_data_collection_settings()

method get_predictions_data_collection_settings()

Retrieve predictions data collection settings of this deployment.

Added in version v2.21.

Returns

Returns Description
predictions_data_collection_settings - enabled (bool) : If predictions data collection is enabled for this deployment. To update existing ‘’predictions_data_collection’’ settings, see update_predictions_data_collection_settings()

Return type: dict in the following format:

SEE ALSO

datarobot.models.Deployment.update_predictions_data_collection_settings : Method to update existing predictions data collection settings.

update_predictions_data_collection_settings()

method update_predictions_data_collection_settings()

Update predictions data collection settings of this deployment.

Added in version v2.21.

Updating predictions data collection setting is an asynchronous process, which means some preparatory work may be performed after the initial request is completed. This function will not return until all preparatory work is fully finished.

Parameters

Parameter Type Description
enabled bool if predictions data collection is to be turned on
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

get_prediction_warning_settings()

method get_prediction_warning_settings()

Retrieve prediction warning settings of this deployment.

Added in version v2.19.

Returns

Returns Description
settings

Return type: PredictionWarningSettings

update_prediction_warning_settings()

method update_prediction_warning_settings()

Update prediction warning settings of this deployment.

Added in version v2.19.

Parameters

Parameter Type Description
prediction_warning_enabled bool If prediction warnings should be turned on.
use_default_boundaries Optional[bool] If default boundaries of the model should be used for the deployment.
upper_boundary Optional[float] All predictions greater than provided value will be considered anomalous
lower_boundary Optional[float] All predictions less than provided value will be considered anomalous
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

get_prediction_intervals_settings()

method get_prediction_intervals_settings()

Retrieve prediction intervals settings for this deployment.

Added in version v2.19.

Notes

Note that prediction intervals are only supported for time series deployments.

Returns

Returns Description
settings

Return type: PredictionIntervalsSettings

update_prediction_intervals_settings()

method update_prediction_intervals_settings()

Update prediction intervals settings for this deployment.

Added in version v2.19.

Notes

Updating prediction intervals settings is an asynchronous process, which means some preparatory work may be performed before the settings request is completed. This function will not return until all work is fully finished.

Note that prediction intervals are only supported for time series deployments.

Parameters

Parameter Type Description
percentiles list[int] The prediction intervals percentiles to enable for this deployment. Currently we only support setting one percentile at a time.
enabled Optional[bool] (defaults to True) Whether to enable showing prediction intervals in the results of predictions requested using this deployment.
max_wait Optional[int] seconds to wait for successful resolution

Raises

Exception Description
AssertionError If percentiles is in an invalid format
AsyncFailureError If any of the responses from the server are unexpected
AsyncProcessUnsuccessfulError If the prediction intervals calculation job has failed or has been cancelled.
AsyncTimeoutError If the prediction intervals calculation job did not resolve in time

Return type: None

get_health_settings()

method get_health_settings()

Retrieve health settings of this deployment.

Added in version v3.4.

Returns

Returns Description
settings

Return type: HealthSettings

update_health_settings()

method update_health_settings()

Update health settings of this deployment.

Added in version v3.4.

Parameters

Parameter Type Description
service dict Service health settings.
data_drift dict Data drift health settings.
accuracy dict Accuracy health settings.
fairness dict Fairness health settings.
custom_metrics dict Custom metrics health settings.
predictions_timeliness dict Predictions timeliness health settings.
actuals_timeliness dict Actuals timeliness health settings.

Return type: HealthSettings

get_default_health_settings()

method get_default_health_settings()

Retrieve default health settings of this deployment.

Added in version v3.4.

Returns

Returns Description
settings

Return type: HealthSettings

get_service_stats()

method get_service_stats()

Retrieves values of many service stat metrics aggregated over a time period.

Added in version v2.18.

Parameters

Parameter Type Description
model_id Optional[str] the ID of the model
start_time datetime, optional start of the time period
end_time datetime, optional end of the time period
execution_time_quantile Optional[float] quantile for executionTime, defaults to 0.5
response_time_quantile Optional[float] quantile for responseTime, defaults to 0.5
slow_requests_threshold Optional[float] threshold for slowRequests, defaults to 1000
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
service_stats the queried service stats metrics information

Return type: ServiceStats

get_service_stats_over_time()

method get_service_stats_over_time()

Retrieves values of a single service stat metric over a time period.

Added in version v2.18.

Parameters

Parameter Type Description
metric SERVICE_STAT_METRIC, optional the service stat metric to retrieve
model_id Optional[str \| List[str]] the ID of the model
start_time datetime, optional start of the time period
end_time datetime, optional end of the time period
bucket_size Optional[str] time duration of a bucket, in ISO 8601 time duration format
quantile Optional[float] quantile for ‘executionTime’ or ‘responseTime’, ignored when querying other metrics
threshold Optional[int] threshold for ‘slowQueries’, ignored when querying other metrics
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
service_stats_over_time the queried service stats metric over time information

Return type: ServiceStatsOverTime

get_target_drift()

method get_target_drift()

Retrieve target drift information over a certain time period.

Added in version v2.21.

Parameters

Parameter Type Description
model_id str the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
metric str (New in version v2.22) metric used to calculate the drift score
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
target_drift the queried target drift information

Return type: TargetDrift

get_feature_drift()

method get_feature_drift()

Retrieve drift information for deployment’s features over a certain time period.

Added in version v2.21.

Parameters

Parameter Type Description
model_id str the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
metric str (New in version v2.22) The metric used to calculate the drift score. Allowed values include psi, kl_divergence, dissimilarity, hellinger, and js_divergence.
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
feature_drift_data the queried feature drift information

Return type: [FeatureDrift]

get_predictions_over_time()

method get_predictions_over_time()

Retrieve stats of deployment’s prediction response over a certain time period.

Added in version v3.2.

Parameters

Parameter Type Description
model_ids list[str] ID of models to retrieve prediction stats
start_time datetime start of the time period
end_time datetime end of the time period
bucket_size BUCKET_SIZE time duration of each bucket
target_classes list[str] class names of target, only for deployments with multiclass target
include_percentiles bool if the returned data includes percentiles, only for a deployment with a binary and regression target
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
predictions_over_time the queried predictions over time information

Return type: PredictionsOverTime

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
predictions_over_time = deployment.get_predictions_over_time()
predictions_over_time.buckets[0]['mean_predicted_value']
>>>0.3772
predictions_over_time.buckets[0]['row_count']
>>>2000

get_accuracy()

method get_accuracy()

Retrieves values of many accuracy metrics aggregated over a time period.

Added in version v2.18.

Parameters

Parameter Type Description
model_id Optional[str \| List[str]] the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
target_classes list[str], optional Optional list of target class strings
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value
metric str (New in Version v3.9) the metric value to retrieve, must be provided when querying for multiple models
baseline_model_id str (New in Version v3.9) the ID of the baseline model when calculating percentage change

Returns

Returns Description
accuracy the queried accuracy metrics information

Return type: Accuracy

get_accuracy_over_time()

method get_accuracy_over_time()

Retrieves values of a single accuracy metric over a time period.

Added in version v2.18.

Parameters

Parameter Type Description
metric ACCURACY_METRIC the accuracy metric to retrieve
model_id Optional[str \| List[str]] the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
bucket_size str time duration of a bucket, in ISO 8601 time duration format
target_classes list[str], optional Optional list of target class strings
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
accuracy_over_time the queried accuracy metric over time information

Return type: AccuracyOverTime

get_predictions_vs_actuals_over_time()

method get_predictions_vs_actuals_over_time()

Retrieve information for deployment’s predictions vs actuals over a certain time period.

Added in version v3.3.

Parameters

Parameter Type Description
model_ids list[str] The ID of models to retrieve predictions vs actuals stats for.
start_time datetime Start of the time period.
end_time datetime End of the time period.
bucket_size BUCKET_SIZE Time duration of each bucket.
target_classes list[str] Class names of target, only for deployments with a multiclass target.
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
predictions_vs_actuals_over_time The queried predictions vs actuals over time information.

Return type: PredictionsVsActualsOverTime

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
predictions_over_time = deployment.get_predictions_vs_actuals_over_time()
predictions_over_time.buckets[0]['mean_actual_value']
>>>0.6673
predictions_over_time.buckets[0]['row_count_with_actual']
>>>500

get_fairness_scores_over_time()

method get_fairness_scores_over_time()

Retrieves values of a single fairness score over a time period.

Added in version v3.2.

Parameters

Parameter Type Description
model_id str the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
bucket_size str time duration of a bucket, in ISO 8601 time duration format
protected_feature str name of protected feature
fairness_metric str A consolidation of the fairness metrics by the use case.

Returns

Returns Description
fairness_scores_over_time the queried fairness score over time information

Return type: FairnessScoresOverTime

update_secondary_dataset_config()

method update_secondary_dataset_config()

Update the secondary dataset config used by Feature discovery model for a given deployment.

Added in version v2.23.

Parameters

Parameter Type Description
secondary_dataset_config_id str Id of the secondary dataset config
credential_ids list or None List of DatasetsCredentials used by the secondary datasets

Return type: str

Examples

from datarobot import Deployment
deployment = Deployment(deployment_id='5c939e08962d741e34f609f0')
config = deployment.update_secondary_dataset_config('5df109112ca582033ff44084')
config
>>> '5df109112ca582033ff44084'

get_secondary_dataset_config()

method get_secondary_dataset_config()

Get the secondary dataset config used by Feature discovery model for a given deployment.

Added in version v2.23.

Returns

Returns Description
secondary_dataset_config Id of the secondary dataset config

Return type: SecondaryDatasetConfigurations

Examples

from datarobot import Deployment
deployment = Deployment(deployment_id='5c939e08962d741e34f609f0')
deployment.update_secondary_dataset_config('5df109112ca582033ff44084')
config = deployment.get_secondary_dataset_config()
config
>>> '5df109112ca582033ff44084'

get_prediction_results()

method get_prediction_results()

Retrieve a list of prediction results of the deployment.

Added in version v2.24.

Parameters

Parameter Type Description
model_id str the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
actuals_present bool filters predictions results to only those who have actuals present or with missing actuals
offset int this many results will be skipped
limit int at most this many results are returned

Returns

Returns Description
prediction_results a list of prediction results

Return type: list[dict]

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
results = deployment.get_prediction_results()

download_prediction_results()

method download_prediction_results()

Download prediction results of the deployment as a CSV file.

Added in version v2.24.

Parameters

Parameter Type Description
filepath str path of the csv file
model_id str the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
actuals_present bool filters predictions results to only those who have actuals present or with missing actuals
offset int this many results will be skipped
limit int at most this many results are returned

Return type: None

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
results = deployment.download_prediction_results('path_to_prediction_results.csv')

download_scoring_code()

method download_scoring_code()

Retrieve scoring code of the current deployed model.

Added in version v2.24.

Notes

When setting include_agent or include_predictions_explanations or include_prediction_intervals to True, it can take a considerably longer time to download the scoring code.

Parameters

Parameter Type Description
filepath str path of the scoring code file
source_code bool whether source code or binary of the scoring code will be retrieved
include_agent bool whether the scoring code retrieved will include tracking agent
include_prediction_explanations bool whether the scoring code retrieved will include prediction explanations
include_prediction_intervals bool whether the scoring code retrieved will support prediction intervals
max_wait Optional[int] Seconds to wait for successful resolution of a deployment creation job. Deployment supports making predictions only after a deployment creating job has successfully finished

Return type: None

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
results = deployment.download_scoring_code('path_to_scoring_code.jar')

download_model_package_file()

method download_model_package_file()

Retrieve model package file (mlpkg) of the current deployed model.

Added in version v3.3.

Parameters

Parameter Type Description
filepath str The file path of the model package file.
compute_all_ts_intervals bool Includes all time series intervals into the built Model Package (.mlpkg) if set to True.

Return type: None

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.download_model_package_file('path_to_model_package.mlpkg')

delete_monitoring_data()

method delete_monitoring_data()

Delete deployment monitoring data.

Parameters

Parameter Type Description
model_id str id of the model to delete monitoring data
start_time datetime, optional start of the time period to delete monitoring data
end_time datetime, optional end of the time period to delete monitoring data
max_wait Optional[int] seconds to wait for successful resolution

Return type: None

list_shared_roles()

method list_shared_roles()

Get a list of users, groups and organizations that have an access to this user blueprint

Parameters

Parameter Type Description
id Optional[str] Only return the access control information for a organization, group or user with this ID.
name string, Optional Only return the access control information for a organization, group or user with this name.
share_recipient_type enum(```’user’, 'group'`, `'organization'),Optional` Only returns results with the given recipient type.
limit int (Default=0) At most this many results are returned.
offset int (Default=0) This many results will be skipped.

Return type: List[DeploymentSharedRole]

update_shared_roles()

method update_shared_roles()

Share a deployment with a user, group, or organization

Parameters

Parameter Type Description
roles list(or(GrantAccessControlWithUsernameValidator, GrantAccessControlWithIdValidator, SharingRole)) Array of GrantAccessControl objects, up to maximum 100 objects.

Return type: None

share()

method share()

Share a deployment with a user, group, or organization

Parameters

Parameter Type Description
roles list(SharingRole) Array of SharingRole objects.

Return type: None

list_challengers()

method list_challengers()

Get a list of challengers for this deployment.

Added in version v3.4.

Return type: list(Challenger)

get_agent_card()

method get_agent_card()

Retrieve the agent card for this deployment.

Returns

Returns Description
agent_card The agent card associated with this deployment.

Return type: dict

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
agent_card = deployment.get_agent_card()

upload_agent_card()

method upload_agent_card()

Upload or replace the agent card for this deployment.

This is only available for external deployments.

Parameters

Parameter Type Description
agent_card dict The agent card to upload for this deployment.

Returns

Returns Description
agent_card The uploaded agent card.

Return type: dict

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
agent_card = deployment.upload_agent_card({"name": "My Agent", "version": "1.0.0"})

delete_agent_card()

method delete_agent_card()

Delete the agent card for this deployment.

This is only available for external deployments. This operation is idempotent — returns successfully even if no agent card exists.

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.delete_agent_card()

Return type: None

get_champion_model_package()

method get_champion_model_package()

Get a champion model package for this deployment.

Returns

Returns Description
champion_model_package A champion model package object.

Return type: ChampionModelPackage

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
champion_model_package = deployment.get_champion_model_package()

list_prediction_data_exports()

method list_prediction_data_exports()

Retrieve a list of asynchronous prediction data exports.

Parameters

Parameter Type Description
model_id Optional[str] The ID of the model used for prediction data export.
status Optional[str] A prediction data export processing state.
batch Optional[bool] If true, only return batch exports. If false, only return real-time exports. If not provided, return both real-time and batch exports.
limit Optional[int] The maximum number of objects to return. The default is 100 (0 means no limit).
offset Optional[int] The starting offset of the results. The default is 0.

Returns

Returns Description
prediction_data_exports A list of prediction data exports.

Return type: List[PredictionDataExport]

list_actuals_data_exports()

method list_actuals_data_exports()

Retrieve a list of asynchronous actuals data exports.

Parameters

Parameter Type Description
status Optional[str] Actuals data export processing state.
limit Optional[int] The maximum number of objects to return. The default is 100 (0 means no limit).
offset Optional[int] The starting offset of the results. The default is 0.

Returns

Returns Description
actuals_data_exports A list of actuals data exports.

Return type: List[ActualsDataExport]

list_training_data_exports()

method list_training_data_exports()

Retrieve a list of successful training data exports.

Returns

Returns Description
training_data_export A list of training data exports.

Return type: List[TrainingDataExport]

list_data_quality_exports()

method list_data_quality_exports()

Retrieve a list of data-quality export records for a given deployment.

Added in version v3.6.

Parameters

Parameter Type Description
start Union[str, datetime] The earliest time of the objects to return.
end Union[str, datetime] The latest time of the objects to return.
model_id Optional[str] The ID of the model.
prediction_pattern Optional[str] The keywords to search in a predicted value for a text generation target.
prompt_pattern Optional[str] The keywords to search in a prompt value for a text generation target.
actual_pattern Optional[str] The keywords to search in an actual value for a text generation target.
order_by Optional[str] The field to sort by (e.g., associationId, timestamp, or customMetrics). Use a leading ‘-’ to indicate descending order. When ordering by a custom-metric, must also specify ‘order_metric’. The default is None, which equates to ‘-timestamp’.
order_metric Optional[str] When ‘order_by’ is a custom-metric, this specifies the custom-metric name or ID to use for ordering. The default is None.
filter_metric Optional[str] Specifies the metric name or ID to use for matching. Must also use ‘filter_value’ to specify the value that must be matched. The default is None.
filter_value Optional[str] Specifies the value associated with ‘filter_metric’ that must be matched. The default is None.
offset Optional[int] The starting offset of the results. The default is 0.
limit Optional[int] The maximum number of objects to return. The default is 100 (which is maximum).

Returns

Returns Description
data_quality_exports A list of DataQualityExport objects.

Return type: list

Examples

from datarobot import Deployment

deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
data_quality_exports = deployment.list_data_quality_exports(start_time='2024-07-01', end_time='2024-08-01')

get_capabilities()

method get_capabilities()

Get a list capabilities for this deployment.

Added in version v3.5.

Return type: list(Capability)

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
capabilities = deployment.get_capabilities()

get_segment_attributes()

method get_segment_attributes()

Get a list of segment attributes for this deployment.

Added in version v3.6.

Parameters

Parameter Type Description
monitoringType Optional[str] The monitoring type for which segment attributes are being retrieved.

Return type: list(str)

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
segment_attributes = deployment.get_segment_attributes(DEPLOYMENT_MONITORING_TYPE.SERVICE_HEALTH)

get_segment_values()

method get_segment_values()

Get a list of segment values for this deployment.

Added in version v3.6.

Parameters

Parameter Type Description
segment_attribute Optional[str] Represents the different ways that prediction requests can be viewed.
limit int, Optional The maximum number of values to return.
offset int, Optional The starting point of the values to be returned.
search Optional[str] A string to filter the values.

Return type: list(str)

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
segment_values = deployment.get_segment_values(segment_attribute=ReservedSegmentAttributes.CONSUMER)

get_moderation_events()

method get_moderation_events()

Get a list of moderation events for this deployment

Parameters

Parameter Type Description
limit int (Default=100) The maximum number of values to return.
offset int (Default=0) The starting point of the values to be returned.

Returns

Returns Description
events

Return type: List[MLOpsEvent]

get_accuracy_metrics_settings()

method get_accuracy_metrics_settings()

Get accuracy metrics settings for this deployment.

Returns

Returns Description
accuracy_metrics A list of deployment accuracy metric names.

Return type: list(str)

Examples

from datarobot import Deployment

deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
accuracy_metrics = deployment.get_accuracy_metrics_settings()

update_accuracy_metrics_settings()

method update_accuracy_metrics_settings()

Update accuracy metrics settings for this deployment.

Parameters

Parameter Type Description
accuracy_metrics list(str) A list of accuracy metric names.

Returns

Returns Description
accuracy_metrics A list of deployment accuracy metric names.

Return type: list(str)

Examples

from datarobot import Deployment
from datarobot.enums import ACCURACY_METRIC

deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
payload = [ACCURACY_METRIC.AUC, ACCURACY_METRIC.LOGLOSS]
accuracy_metrics = deployment.update_accuracy_metrics_settings(payload)

get_retraining_settings()

method get_retraining_settings()

Retrieve retraining settings of this deployment.

Added in version v2.29.

Returns

Returns Description
settings

Return type: RetrainingSettings

Examples

from datarobot import Deployment

deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
retraining_settings = deployment.get_retraining_settings()

update_retraining_settings()

method update_retraining_settings()

Update retraining settings of this deployment.

Added in version v2.29.

Parameters

Parameter Type Description
retraining_user_id Optional[str] The retraining user ID.
dataset_id Optional[str] The retraining dataset ID.
prediction_environment_id Optional[str] The retraining prediction environment ID.

Return type: None

Examples

from datarobot import Deployment

deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.update_retraining_settings(retaining_user_id='5c939e08962d741e34f609f0')

create_tag()

method create_tag()

Create a new deployment tag.

Parameters

Parameter Type Description
name str The name of the deployment tag.
value str The value of the deployment tag.

Return type: dict[str, str]

update_tag()

method update_tag()

Update an existing deployment tag.

Parameters

Parameter Type Description
id str The ID of the deployment tag.
name str The new name of the deployment tag.
value str The new value of the deployment tag.

Return type: dict[str, str]

delete_tag()

method delete_tag()

Deletes the deployment tag specified by ID.

Parameters

Parameter Type Description
id str The ID of the deployment tag to delete.

Return type: None

from_data()

classmethod from_data()

Instantiate an object of this class using a dict.

Parameters

Parameter Type Description
data dict Correctly snake_cased keys and their values.

Return type: TypeVar(T, bound= APIObject)

from_server_data()

classmethod from_server_data()

Instantiate an object of this class using the data directly from the server, meaning that the keys may have the wrong camel casing

Parameters

Parameter Type Description
data dict The directly translated dict of JSON from the server. No casing fixes have taken place
keep_attrs iterable List, set or tuple of the dotted namespace notations for attributes to keep within the object structure even if their values are None

Return type: TypeVar(T, bound= APIObject)

open_in_browser()

method open_in_browser()

Opens class’ relevant web browser location. If default browser is not available the URL is logged.

Note: If text-mode browsers are used, the calling process will block until the user exits the browser.

Return type: None

DeploymentListFilters

class datarobot.models.deployment.DeploymentListFilters

Construct a set of filters to pass to Deployment.list()

Added in version v2.20.

Parameters

Parameter Type Description
role str A user role. If specified, then take those deployments that the user can view, then filter them down to those that the user has the specified role for, and return only them. Allowed options are OWNER and USER.
service_health List[str] A list of service health status values. If specified, then only deployments whose service health status is one of these will be returned. See datarobot.enums.DEPLOYMENT_SERVICE_HEALTH_STATUS for allowed values. Supports comma-separated lists.
model_health List[str] A list of model health status values. If specified, then only deployments whose model health status is one of these will be returned. See datarobot.enums.DEPLOYMENT_MODEL_HEALTH_STATUS for allowed values. Supports comma-separated lists.
accuracy_health List[str] A list of accuracy health status values. If specified, then only deployments whose accuracy health status is one of these will be returned. See datarobot.enums.DEPLOYMENT_ACCURACY_HEALTH_STATUS for allowed values. Supports comma-separated lists.
execution_environment_type List[str] A list of strings representing the type of the deployments’ execution environment. If provided, then only return those deployments whose execution environment type is one of those provided. See datarobot.enums.DEPLOYMENT_EXECUTION_ENVIRONMENT_TYPE for allowed values. Supports comma-separated lists.
importance List[str] A list of strings representing the deployments’ “importance”. If provided, then only return those deployments whose importance is one of those provided. See datarobot.enums.DEPLOYMENT_IMPORTANCE for allowed values. Supports comma-separated lists. Note that Approval Workflows must be enabled for your account to use this filter, otherwise the API will return a 403.
tag_keys List[str] List of tag keys to filter for. If multiple values are specified, deployments with tags that match any of the values will be returned. Supports comma-separated lists.
tag_values List[str] List of tag values to filter for. If multiple values are specified, deployments with tags that match any of the values will be returned. Supports comma-separated lists.
is_a2a_agent bool If specified, filters deployments based on whether they are A2A agents.”

Examples

Multiple filters can be combined in interesting ways to return very specific subsets of deployments.

Performing AND logic

Providing multiple different parameters will result in AND logic between them. For example, the following will return all deployments that I own whose service health status is failing.

from datarobot import Deployment
from datarobot.models.deployment import DeploymentListFilters
from datarobot.enums import DEPLOYMENT_SERVICE_HEALTH_STATUS
filters = DeploymentListFilters(
    role='OWNER',
    service_health=[DEPLOYMENT_SERVICE_HEALTH.FAILING]
)
deployments = Deployment.list(filters=filters)

Performing OR logic

Some filters support comma-separated lists (and will say so if they do). Providing a comma-separated list of values to a single filter performs OR logic between those values. For example, the following will return all deployments whose service health is either warning OR failing.

from datarobot import Deployment
from datarobot.models.deployment import DeploymentListFilters
from datarobot.enums import DEPLOYMENT_SERVICE_HEALTH_STATUS
filters = DeploymentListFilters(
    service_health=[
        DEPLOYMENT_SERVICE_HEALTH.WARNING,
        DEPLOYMENT_SERVICE_HEALTH.FAILING,
    ]
)
deployments = Deployment.list(filters=filters)

Performing OR logic across different filter types is not supported.

Notes

In all cases, you may only retrieve deployments for which you have at least the USER role for. Deployments for which you are a CONSUMER of will not be returned, regardless of the filters applied.

ServiceStats

class datarobot.models.deployment.ServiceStats

Deployment service stats information.

Variables

Attribute Type Description
model_id str the model used to retrieve service stats metrics
period dict the time period used to retrieve service stats metrics
metrics dict the service stats metrics

get()

classmethod get()

Retrieve value of service stat metrics over a certain time period.

Added in version v2.18.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
model_id Optional[str] the ID of the model
start_time datetime, optional start of the time period
end_time datetime, optional end of the time period
execution_time_quantile Optional[float] quantile for executionTime, defaults to 0.5
response_time_quantile Optional[float] quantile for responseTime, defaults to 0.5
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value
slow_requests_threshold Optional[float] threshold for slowRequests, defaults to 1000

Returns

Returns Description
service_stats the queried service stats metrics

Return type: ServiceStats

ServiceStatsOverTime

class datarobot.models.deployment.ServiceStatsOverTime

Deployment service stats over time information.

Variables

Attribute Type Description
metric str the service stat metric being retrieved
buckets dict how the service stat metric changes over time

get()

classmethod get()

Retrieve information about how a service stat metric changes over a certain time period.

Added in version v2.18.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
metric SERVICE_STAT_METRIC, optional the service stat metric to retrieve
model_id Optional[str \| List[str]] the ID of the model
start_time datetime, optional start of the time period
end_time datetime, optional end of the time period
bucket_size Optional[str] time duration of a bucket, in ISO 8601 time duration format
quantile Optional[float] quantile for ‘executionTime’ or ‘responseTime’, ignored when querying other metrics
threshold Optional[int] threshold for ‘slowQueries’, ignored when querying other metrics
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
service_stats_over_time the queried service stat over time information

Return type: ServiceStatsOverTime

bucket_values

property bucket_values

The metric value for all time buckets, keyed by start time of the bucket.

Returns

Returns Description
bucket_values

Return type: OrderedDict

TargetDrift

class datarobot.models.deployment.TargetDrift

Deployment target drift information.

Variables

Attribute Type Description
model_id str the model used to retrieve target drift metric
period dict the time period used to retrieve target drift metric
metric str the data drift metric
target_name str name of the target
drift_score float target drift score
sample_size int count of data points for comparison
baseline_sample_size int count of data points for baseline

get()

classmethod get()

Retrieve target drift information over a certain time period.

Added in version v2.21.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
model_id str the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
metric str (New in version v2.22) metric used to calculate the drift score
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
target_drift the queried target drift information

Return type: TargetDrift

Examples

from datarobot import Deployment, TargetDrift
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
target_drift = TargetDrift.get(deployment.id)
target_drift.period['end']
>>>'2019-08-01 00:00:00+00:00'
target_drift.drift_score
>>>0.03423
accuracy.target_name
>>>'readmitted'

FeatureDrift

class datarobot.models.deployment.FeatureDrift

Deployment feature drift information.

Variables

Attribute Type Description
model_id str the model used to retrieve feature drift metric
period dict the time period used to retrieve feature drift metric
metric str the data drift metric
name str name of the feature
drift_score float feature drift score
sample_size int count of data points for comparison
baseline_sample_size int count of data points for baseline

list()

classmethod list()

Retrieve drift information for deployment’s features over a certain time period.

Added in version v2.21.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
model_id str the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
metric str (New in version v2.22) metric used to calculate the drift score
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
feature_drift_data the queried feature drift information

Return type: [FeatureDrift]

Examples

from datarobot import Deployment, TargetDrift
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
feature_drift = FeatureDrift.list(deployment.id)[0]
feature_drift.period
>>>'2019-08-01 00:00:00+00:00'
feature_drift.drift_score
>>>0.252
feature_drift.name
>>>'age'

PredictionsOverTime

class datarobot.models.deployment.PredictionsOverTime

Deployment predictions over time information.

Variables

Attribute Type Description
baselines List target baseline for each model queried
buckets List predictions over time bucket for each model and bucket queried

get()

classmethod get()

Retrieve information for deployment’s prediction response over a certain time period.

Added in version v3.2.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
model_ids list[str] ID of models to retrieve prediction stats
start_time datetime start of the time period
end_time datetime end of the time period
bucket_size BUCKET_SIZE time duration of each bucket
target_classes list[str] class names of target, only for deployments with multiclass target
include_percentiles bool if the returned data includes percentiles, only for a deployment with a binary and regression target
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
predictions_over_time the queried predictions over time information

Return type: PredictionsOverTime

Accuracy

class datarobot.models.deployment.Accuracy

Deployment accuracy information.

Variables

Attribute Type Description
model_id str the model used to retrieve accuracy metrics
period dict the time period used to retrieve accuracy metrics
metrics dict the accuracy metrics

get()

classmethod get()

Retrieve values of accuracy metrics over a certain time period.

Added in version v2.18.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
model_id Optional[str \| List[str]] the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
target_classes list[str], optional Optional list of target class strings
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value
metric str (New in Version v3.9) the metric value to retrieve, must be provided when querying for multiple models
baseline_model_id str (New in Version v3.9) the ID of the baseline model when calculating percentage change

Returns

Returns Description
accuracy the queried accuracy metrics information

Return type: Accuracy

Examples

from datarobot import Deployment, Accuracy
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
accuracy = Accuracy.get(deployment.id)
accuracy.period['end']
>>>'2019-08-01 00:00:00+00:00'
accuracy.metric['LogLoss']['value']
>>>0.7533
accuracy.metric_values['LogLoss']
>>>0.7533

metric_values

property metric_values

The value for all metrics, keyed by metric name.

Returns

Returns Description
metric_values

Return type: Dict

metric_baselines

property metric_baselines

The baseline value for all metrics, keyed by metric name.

Returns

Returns Description
metric_baselines

Return type: Dict

percent_changes

property percent_changes

The percent change of value over baseline for all metrics, keyed by metric name.

Returns

Returns Description
percent_changes

Return type: Dict

AccuracyOverTime

class datarobot.models.deployment.AccuracyOverTime

Deployment accuracy over time information.

Variables

Attribute Type Description
metric str the accuracy metric being retrieved
buckets list how the accuracy metric changes over time
baselines list baselines for the accuracy metric

get()

classmethod get()

Retrieve information about how an accuracy metric changes over a certain time period.

Added in version v2.18.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
metric ACCURACY_METRIC the accuracy metric to retrieve
model_id Optional[str \| List[str]] the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
bucket_size str time duration of a bucket, in ISO 8601 time duration format
target_classes list[str], optional Optional list of target class strings
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
accuracy_over_time the queried accuracy metric over time information

Return type: AccuracyOverTime

Examples

from datarobot import Deployment, AccuracyOverTime
from datarobot.enums import ACCURACY_METRICS
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
accuracy_over_time = AccuracyOverTime.get(deployment.id, metric=ACCURACY_METRIC.LOGLOSS)
accuracy_over_time.metric
>>>'LogLoss'
accuracy_over_time.metric_values
>>>{datetime.datetime(2019, 8, 1): 0.73, datetime.datetime(2019, 8, 2): 0.55}

get_as_dataframe()

classmethod get_as_dataframe()

Retrieve information about how a list of accuracy metrics change over a certain time period as pandas DataFrame.

In the returned DataFrame, the columns corresponds to the metrics being retrieved; the rows are labeled with the start time of each bucket.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
metrics [ACCURACY_METRIC] the accuracy metrics to retrieve
model_id Optional[str \| List[str]] the ID of the model
start_time datetime start of the time period
end_time datetime end of the time period
bucket_size str time duration of a bucket, in ISO 8601 time duration format

Returns

Returns Description
accuracy_over_time

Return type: pd.DataFrame

bucket_values

property bucket_values

The metric value for all time buckets, keyed by start time of the bucket.

Returns

Returns Description
bucket_values

Return type: Dict

bucket_sample_sizes

property bucket_sample_sizes

The sample size for all time buckets, keyed by start time of the bucket.

Returns

Returns Description
bucket_sample_sizes

Return type: Dict

PredictionsVsActualsOverTime

class datarobot.models.deployment.PredictionsVsActualsOverTime

Deployment predictions vs actuals over time information.

Variables

Attribute Type Description
summary dict predictions vs actuals over time summary for all models and buckets queried
baselines List target baseline for each model queried
buckets List predictions vs actuals over time bucket for each model and bucket queried
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

get()

classmethod get()

Retrieve information for deployment’s predictions vs actuals over a certain time period.

Added in version v3.3.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
model_ids list[str] ID of models to retrieve predictions vs actuals stats
start_time datetime start of the time period
end_time datetime end of the time period
bucket_size BUCKET_SIZE time duration of each bucket
target_classes list[str] class names of target, only for deployments with multiclass target
segment_attribute Optional[str] (New in Version v3.6) the segment attribute
segment_value Optional[str] (New in Version v3.6) the segment value

Returns

Returns Description
predictions_vs_actuals_over_time the queried predictions vs actuals over time information

Return type: PredictionsVsActualsOverTime

FairnessScoresOverTime

class datarobot.models.deployment.bias_and_fairness.FairnessScoresOverTime

Deployment fairness over time information.

Variables

Attribute Type Description
buckets List fairness over time bucket for each model and bucket queried
summary dict summary for the fairness score
protected_feature str name of protected feature
fairnessThreshold float threshold used to compute fairness results
modelId str model id for which fairness is computed
modelPackageId str model package (version) id for which fairness is computed
favorableTargetOutcome bool preferable class of the target

get()

classmethod get()

Retrieve information for deployment’s fairness score response over a certain time period.

Added in version FUTURE.

Parameters

Parameter Type Description
deployment_id str the ID of the deployment
model_id str id of models to retrieve fairness score stats
start_time datetime start of the time period
end_time datetime end of the time period
protected_feature str name of the protected feature
fairness_metric str A consolidation of the fairness metrics by the use case.
bucket_size BUCKET_SIZE time duration of each bucket

Returns

Returns Description
fairness_scores_over_time the queried fairness score over time information

Return type: FairnessScoresOverTime

DeploymentSharedRole

class datarobot.models.deployment.DeploymentSharedRole

Parameters

Parameter Type Description
share_recipient_type {'user', 'group', 'organization'} Describes the recipient type, either user, group, or organization.
role {'CONSUMER', 'USER', 'OWNER'} The role of the org/group/user on this deployment.
id str The ID of the recipient organization, group, or user.
name str The name of the recipient organization, group, or user.

DeploymentGrantSharedRoleWithId

class datarobot.models.deployment.DeploymentGrantSharedRoleWithId

Parameters

Parameter Type Description
share_recipient_type {'user', 'group', 'organization'} Describes the recipient type, either user, group, or organization.
role {'OWNER', 'USER', 'OBSERVER', 'NO_ROLE'} The role of the recipient on this entity. One of OWNER, USER, OBSERVER, NO_ROLE. If NO_ROLE is specified, any existing role for the recipient will be removed.
id str The ID of the recipient.

DeploymentGrantSharedRoleWithUsername

class datarobot.models.deployment.DeploymentGrantSharedRoleWithUsername

Parameters

Parameter Type Description
role string The role of the recipient on this entity. One of OWNER, USER, CONSUMER, NO_ROLE. If NO_ROLE is specified, any existing role for the user will be removed.
username string Username of the user to update the access role for.

FeatureDict

class datarobot.models.deployment.deployment.FeatureDict

ForecastDateSettings

class datarobot.models.deployment.deployment.ForecastDateSettings

Forecast date settings of the deployment

Variables

Attribute Type Description
enabled bool Is True if predictions by forecast date is enabled for this deployment. To update this setting, see update_predictions_by_forecast_date_settings()
column_name str The column name in prediction datasets to be used as forecast date.
datetime_format str The datetime format of the forecast date column in prediction datasets.

ChallengerModelsSettings

class datarobot.models.deployment.deployment.ChallengerModelsSettings

Challenger models settings of the deployment is a dict with the following format:

Variables

Attribute Type Description
enabled bool Is True if challenger models is enabled for this deployment. To update existing ‘’challenger_models’’ settings, see update_challenger_models_settings()

SegmentAnalysisSettings

class datarobot.models.deployment.deployment.SegmentAnalysisSettings

Segment analysis settings of the deployment containing two items with keys : enabled and attributes, which are further described below.

Variables

Attribute Type Description
enabled bool Set to True if segment analysis is enabled for this deployment. To update existing setting, see update_segment_analysis_settings()
attributes list To create or update existing segment analysis attributes, see update_segment_analysis_settings()

BiasAndFairnessSettings

class datarobot.models.deployment.deployment.BiasAndFairnessSettings

Bias and fairness settings of this deployment

Variables

Attribute Type Description
protected_features List[str] A list of features to mark as protected.
preferable_target_value bool A target value that should be treated as a positive outcome for the prediction.
fairness_metric_set str Can be one of . A set of fairness metrics to use for calculating fairness.
fairness_threshold float Threshold value of the fairness metric. Cannot be less than 0 or greater than 1.

ChallengerReplaySettings

class datarobot.models.deployment.deployment.ChallengerReplaySettings

Challenger replay settings of the deployment is a dict with the following format:

Variables

Attribute Type Description
enabled bool If challenger replay is enabled. To update existing challenger_replay settings, see update_challenger_replay_settings()
schedule Schedule The recurring schedule for the challenger replay job.

HealthSettings

class datarobot.models.deployment.deployment.HealthSettings

Health settings of the deployment containing seven nested dicts with keys

Variables

Attribute Type Description
service dict Service health settings.
data_drift dict Data drift health settings.
accuracy dict Accuracy health settings.
fairness dict Fairness health settings.
custom_metrics dict Custom metrics health settings.
predictions_timeliness dict Predictions timeliness health settings.
actuals_timeliness dict Actuals timeliness health settings.

DriftTrackingSettings

class datarobot.models.deployment.deployment.DriftTrackingSettings

Drift tracking settings of the deployment containing two nested dicts with key : target_drift and feature_drift, which are further described below.

Variables

Attribute Type Description
target_drift Settings If target drift tracking is enabled for this deployment. To create or update existing target_drift settings, see update_drift_tracking_settings()
feature_drift Settings If feature drift tracking is enabled for this deployment. To create or update existing feature_drift settings, see update_drift_tracking_settings()

PredictionWarningSettings

class datarobot.models.deployment.deployment.PredictionWarningSettings

Prediction warning settings of the deployment

Variables

Attribute Type Description
enabled bool If target prediction_warning is enabled for this deployment. To create or update existing ‘’prediction_warning’’ settings, see update_prediction_warning_settings()
custom_boundaries dict or None If None default boundaries for a model are used. Otherwise has following keys:upper (float): All predictions greater than provided value are considered anomalous lower (float): All predictions less than provided value are considered anomalous

PredictionIntervalsSettings

class datarobot.models.deployment.deployment.PredictionIntervalsSettings

Prediction intervals settings of the deployment is a dict with the following format:

Variables

Attribute Type Description
enabled bool Whether prediction intervals are enabled for this deployment
percentiles list[int] List of enabled prediction intervals’ sizes for this deployment. Currently we only support one percentile at a time.

Capability

class datarobot.models.deployment.deployment.Capability

ACCURACY_METRIC

class datarobot.enums.ACCURACY_METRIC

Predictions

Predictions

class datarobot.models.Predictions

Represents predictions metadata and provides access to prediction results.

Variables

Attribute Type Description
project_id str id of the project the model belongs to
model_id str id of the model
prediction_id str id of generated predictions
includes_prediction_intervals Optional[bool] (New in v2.16) For time series projects only. Indicates if prediction intervals will be part of the response. Defaults to False.
prediction_intervals_size Optional[int] (New in v2.16) For time series projects only. Indicates the percentile used for prediction intervals calculation. Will be present only if includes_prediction_intervals is True.
forecast_point datetime.datetime, optional (New in v2.20) For time series projects only. This is the default point relative to which predictions will be generated, based on the forecast window of the project. See the time series prediction documentation for more information.
predictions_start_date datetime.datetime or None, optional (New in v2.20) For time series projects only. The start date for bulk predictions. Note that this parameter is for generating historical predictions using the training data. This parameter should be provided in conjunction with predictions_end_date. Can’t be provided with the forecast_point parameter.
predictions_end_date datetime.datetime or None, optional (New in v2.20) For time series projects only. The end date for bulk predictions, exclusive. Note that this parameter is for generating historical predictions using the training data. This parameter should be provided in conjunction with predictions_start_date. Can’t be provided with the forecast_point parameter.
actual_value_column string, optional (New in version v2.21) For time series unsupervised projects only. Actual value column which was used to calculate the classification metrics and insights on the prediction dataset. Can’t be provided with the forecast_point parameter.
explanation_algorithm datarobot.enums.EXPLANATIONS_ALGORITHM, optional (New in version v2.21) If set to ‘shap’, the response will include prediction explanations based on the SHAP explainer (SHapley Additive exPlanations). Defaults to null (no prediction explanations).
max_explanations Optional[int] (New in version v2.21) The maximum number of explanation values that should be returned for each row, ordered by absolute value, greatest to least. If null, no limit. In the case of ‘shap’: if the number of features is greater than the limit, the sum of remaining values will also be returned as shapRemainingTotal. Defaults to null. Cannot be set if explanation_algorithm is omitted.
shap_warnings dict, optional (New in version v2.21) Will be present if explanation_algorithm was set to datarobot.enums.EXPLANATIONS_ALGORITHM.SHAP and there were additivity failures during SHAP values calculation.

Examples

List all predictions for a project

import datarobot as dr

# Fetch all predictions for a project
all_predictions = dr.Predictions.list(project_id)

# Inspect all calculated predictions
for predictions in all_predictions:
    print(predictions)  # repr includes project_id, model_id, and dataset_id

Retrieve predictions by id

import datarobot as dr

# Getting predictions by id
predictions = dr.Predictions.get(project_id, prediction_id)

# Dump actual predictions
df = predictions.get_all_as_dataframe()
print(df)

list()

classmethod list()

Fetch all the computed predictions metadata for a project.

Parameters

Parameter Type Description
project_id str id of the project
model_id Optional[str] if specified, only predictions metadata for this model will be retrieved
dataset_id Optional[str] if specified, only predictions metadata for this dataset will be retrieved

Return type: A list of Predictions objects

get()

classmethod get()

Retrieve the specific predictions metadata

Parameters

Parameter Type Description
project_id str id of the project the model belongs to
prediction_id str id of the prediction set

Return type: Predictions

Returns

Returns Description
* Predictions object representing specified
* predictions

get_all_as_dataframe()

method get_all_as_dataframe()

Retrieve all prediction rows and return them as a pandas.DataFrame.

Parameters

Parameter Type Description
class_prefix Optional[str] The prefix to append to labels in the final dataframe. Default is class_ (e.g., apple -> class_apple)
serializer Optional[str] Serializer to use for the download. Options: json (default) or csv.

Returns

Returns Description
dataframe

Return type: pandas.DataFrame

Raises

Exception Description
datarobot.errors.ClientError if the server responded with 4xx status.
datarobot.errors.ServerError if the server responded with 5xx status.

download_to_csv()

method download_to_csv()

Save prediction rows into CSV file.

Parameters

Parameter Type Description
filename str or file object path or file object to save prediction rows
encoding string, optional A string representing the encoding to use in the output file, defaults to ‘utf-8’
serializer Optional[str] Serializer to use for the download. Options: json (default) or csv.

Return type: None

PredictionServer

PredictionServer

class datarobot.PredictionServer

A prediction server can be used to make predictions.

Variables

Attribute Type Description
id Optional[str] The id of the prediction server.
url str The url of the prediction server.
datarobot_key Optional[str] The Datarobot-Key HTTP header used in requests to this prediction server. Note that in the datarobot.models.Deployment instance there is the default_prediction_server property which has this value as a “kebab-cased” key as opposed to “snake_cased”.

list()

classmethod list()

Returns a list of prediction servers a user can use to make predictions.

Added in version v2.17.

Returns

Returns Description
prediction_servers Contains a list of prediction servers that can be used to make predictions.

Return type: list of PredictionServer instances

Examples

prediction_servers = PredictionServer.list()
prediction_servers
>>> [PredictionServer('https://example.com')]

Prediction environment

PredictionEnvironment

class datarobot.models.PredictionEnvironment

A prediction environment entity.

Added in version v3.3.0.

Variables

Attribute Type Description
id str The ID of the prediction environment.
name str The name of the prediction environment.
description Optional[str] The description of the prediction environment.
platform Optional[str] Indicates which platform is in use (AWS, GCP, DataRobot, etc.).
permissions Optional[List] A set of permissions for the prediction environment.
is_deleted boolean, optional The flag that shows if this prediction environment deleted.
supported_model_formats list[PredictionEnvironmentModelFormats], optional The list of supported model formats.
is_managed_by_management_agent boolean, optional Determines if the prediction environment should be managed by the management agent. False by default.
datastore_id Optional[str] The ID of the data store connection configuration. Only applicable for external prediction environments managed by DataRobot.
credential_id Optional[str] The ID of the credential associated with the data connection. Only applicable for external prediction environments managed by DataRobot.

list()

classmethod list()

Returns list of available external prediction environments.

Returns

Returns Description
prediction_environments contains a list of available prediction environments.

Return type: list of PredictionEnvironment instances

Examples

>>> import datarobot as dr
>>> prediction_environments = dr.PredictionEnvironment.list()
>>> prediction_environments
[
    PredictionEnvironment('5e429d6ecf8a5f36c5693e03', 'demo_pe', 'aws', 'env for demo testing'),
    PredictionEnvironment('5e42cc4dcf8a5f3256865840', 'azure_pe', 'azure', 'env for azure demo testing'),
]

get()

classmethod get()

Gets the PredictionEnvironment by id.

Parameters

Parameter Type Description
pe_id str the identifier of the PredictionEnvironment.

Returns

Returns Description
prediction_environment the requested prediction environment object.

Return type: PredictionEnvironment

Examples

>>> import datarobot as dr
>>> pe = dr.PredictionEnvironment.get('5a8ac9ab07a57a1231be501f')
>>> pe
PredictionEnvironment('5a8ac9ab07a57a1231be501f', 'my_predict_env', 'aws', 'demo env'),

delete()

method delete()

Deletes the prediction environment.

Examples

>>> import datarobot as dr
>>> pe = dr.PredictionEnvironment.get('5a8ac9ab07a57a1231be501f')
>>> pe.delete()

Return type: None

create()

classmethod create()

Create a prediction environment.

Parameters

Parameter Type Description
name str The name of the prediction environment.
description Optional[str] The description of the prediction environment.
platform str Indicates which platform is in use (AWS, GCP, DataRobot, etc.).
plugin str Optional. The plugin name to use.
supported_model_formats list[PredictionEnvironmentModelFormats], optional The list of supported model formats. When not provided, the default value is inferred based on platform, (DataRobot platform: DataRobot, Custom Models; All other platforms: DataRobot, Custom Models, External Models).
is_managed_by_management_agent boolean, optional Determines if this prediction environment should be managed by the management agent. default: False
datastore DataStore\|Optional[str]] The datastore object or ID of the data store connection configuration. Only applicable for external Prediction Environments managed by DataRobot.
credential Credential\|Optional[str]] The credential object or ID of the credential associated with the data connection. Only applicable for external Prediction Environments managed by DataRobot.

Returns

Returns Description
prediction_environment the prediction environment was created

Return type: PredictionEnvironment

Raises

Exception Description
datarobot.errors.ClientError If the server responded with 4xx status.
datarobot.errors.ServerError If the server responded with 5xx status.

Examples

>>> import datarobot as dr
>>> pe = dr.PredictionEnvironment.create(
...     name='my_predict_env',
...     platform=PredictionEnvironmentPlatform.AWS,
...     description='demo prediction env',
... )
>>> pe
PredictionEnvironment('5e429d6ecf8a5f36c5693e99', 'my_predict_env', 'aws', 'demo prediction env'),