Deployment

class datarobot.models.Deployment(id, label=None, description=None, status=None, default_prediction_server=None, model=None, model_package=None, capabilities=None, prediction_usage=None, permissions=None, service_health=None, model_health=None, accuracy_health=None, importance=None, fairness_health=None, governance=None, owners=None, prediction_environment=None)

A deployment created from a DataRobot model.

Attributes:
idstr

the id of the deployment

labelstr

the label of the deployment

descriptionstr

the description of the deployment

statusstr

(New in version v2.29) deployment status

default_prediction_serverdict

Information about the default prediction server for the deployment. Accepts the following values:

  • id: str. Prediction server ID.

  • url: str, optional. Prediction server URL.

  • datarobot-key: str. Corresponds the to the PredictionServer’s “snake_cased” datarobot_key parameter that allows you to verify and access the prediction server.

importancestr, optional

deployment importance

modeldict

information on the model of the deployment

model_packagedict

(New in version v3.4) information on the model package of the deployment

capabilitiesdict

information on the capabilities of the deployment

prediction_usagedict

information on the prediction usage of the deployment

permissionslist

(New in version v2.18) user’s permissions on the deployment

service_healthdict

information on the service health of the deployment

model_healthdict

information on the model health of the deployment

accuracy_healthdict

information on the accuracy health of the deployment

fairness_healthdict

information on the fairness health of a deployment

governancedict

information on approval and change requests of a deployment

ownersdict

information on the owners of a deployment

prediction_environmentdict

information on the prediction environment of a deployment

classmethod create_from_learning_model(model_id, label, description=None, default_prediction_server_id=None, importance=None, prediction_threshold=None, status=None, max_wait=600)

Create a deployment from a DataRobot model. :rtype: TypeVar(TDeployment, bound= Deployment)

Added in version v2.17.

Parameters:
model_idstr

id of the DataRobot model to deploy

labelstr

a human-readable label of the deployment

descriptionstr, optional

a human-readable description of the deployment

default_prediction_server_idstr, optional

an identifier of a prediction server to be used as the default prediction server

importancestr, optional

deployment importance

prediction_thresholdfloat, optional

threshold used for binary classification in predictions

statusstr, optional

deployment status

max_wait: int, optional

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

The created 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')
classmethod create_from_leaderboard(model_id, label, description=None, default_prediction_server_id=None, importance=None, prediction_threshold=None, status=None, max_wait=600)

Create a deployment from a Leaderboard. :rtype: TypeVar(TDeployment, bound= Deployment)

Added in version v2.17.

Parameters:
model_idstr

id of the Leaderboard to deploy

labelstr

a human-readable label of the deployment

descriptionstr, optional

a human-readable description of the deployment

default_prediction_server_idstr, optional

an identifier of a prediction server to be used as the default prediction server

importancestr, optional

deployment importance

prediction_thresholdfloat, optional

threshold used for binary classification in predictions

statusstr, optional

deployment status

max_waitint, optional

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

The created 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')
classmethod create_from_custom_model_version(custom_model_version_id, label, description=None, default_prediction_server_id=None, max_wait=600, importance=None)

Create a deployment from a DataRobot custom model image.

Parameters:
custom_model_version_idstr

The ID of the DataRobot custom model version to deploy. The version must have a base_environment_id.

labelstr

A label of the deployment.

descriptionstr, optional

A description of the deployment.

default_prediction_server_idstr

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_waitint, optional

Seconds to wait for successful resolution of a deployment creation job. Deployment supports making predictions only after a deployment creating job has successfully finished.

importancestr, optional

Deployment importance level.

Returns:
deploymentDeployment

The created deployment

Return type:

TypeVar(TDeployment, bound= Deployment)

classmethod create_from_registered_model_version(model_package_id, label, description=None, default_prediction_server_id=None, prediction_environment_id=None, importance=None, user_provided_id=None, additional_metadata=None, max_wait=600)

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

Parameters:
model_package_idstr

The ID of the DataRobot model package (version) to deploy.

labelstr

A human readable label of the deployment.

descriptionstr, optional

A human readable description of the deployment.

default_prediction_server_idstr, optional

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_idstr, optional

An identifier of a prediction environment to be used for model deployment.

importancestr, optional

Deployment importance level.

user_provided_idstr, optional

A user-provided unique ID associated with a deployment definition in a remote git repository.

additional_metadatadict, optional

‘Key/Value pair dict, with additional metadata’

max_waitint, optional

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

The created deployment

Return type:

TypeVar(TDeployment, bound= Deployment)

classmethod list(order_by=None, search=None, filters=None, offset=0, limit=0)

List all deployments a user can view. :rtype: List[TypeVar(TDeployment, bound= Deployment)]

Added in version v2.17.

Parameters:
order_bystr, optional

(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.

searchstr, optional

(New in version v2.18) case insensitive search against deployment’s label and description.

filtersdatarobot.models.deployment.DeploymentListFilters, optional

(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:
deploymentslist

a list of deployments the user can view

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')]
classmethod get(deployment_id)

Get information about a deployment. :rtype: TypeVar(TDeployment, bound= Deployment)

Added in version v2.17.

Parameters:
deployment_idstr

the id of the deployment

Returns:
deploymentDeployment

the queried deployment

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.id
>>>'5c939e08962d741e34f609f0'
deployment.label
>>>'New Deployment'
predict_batch(source, passthrough_columns=None, download_timeout=None, download_read_timeout=None, upload_read_timeout=None)

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. :rtype: DataFrame

Added in version v3.0.

Parameters:
source: str, pd.DataFrame or file object

Pass a filepath, file, or DataFrame for making batch predictions.

passthrough_columnslist[string] (optional)

Keep these columns from the scoring dataset in the scored dataset. This is useful for correlating predictions with source data.

download_timeout: int, optional

Wait this many seconds for the download to become available. See datarobot.models.BatchPredictionJob.score().

download_read_timeout: int, optional

Wait this many seconds for the server to respond between chunks. See datarobot.models.BatchPredictionJob.score().

upload_read_timeout: int, optional

Wait this many seconds for the server to respond after a whole dataset upload. See datarobot.models.BatchPredictionJob.score().

Returns:
pd.DataFrame

Prediction results in a pandas DataFrame.

Raises:
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()
Returns:
urlstr

Deployment’s overview URI

Return type:

str

update(label=None, description=None, importance=None)

Update the label and description of this deployment. :rtype: None

Added in version v2.19.

delete()

Delete this deployment. :rtype: None

Added in version v2.17.

activate(max_wait=600)

Activates this deployment. When succeeded, deployment status become active. :rtype: None

Added in version v2.29.

Parameters:
max_waitint, optional

The maximum time to wait for deployment activation to complete before erroring

deactivate(max_wait=600)

Deactivates this deployment. When succeeded, deployment status become inactive. :rtype: None

Added in version v2.29.

Parameters:
max_waitint, optional

The maximum time to wait for deployment deactivation to complete before erroring

replace_model(new_model_id, reason, max_wait=600, new_registered_model_version_id=None)
Return type:

None

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:
new_model_idOptional[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.

reasonMODEL_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_waitint, optional

(new in version 2.22) The maximum time to wait for model replacement job to complete before erroring

new_registered_model_version_idOptional[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.

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(new_registered_model_version_id, reason, max_wait=600)
Return type:

None

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

The registered model version (model package) ID of the new model to use.

reasonMODEL_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_waitint, optional

The maximum time to wait for model replacement job to complete before erroring

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(new_model_id=None, new_registered_model_version_id=None)

Validate a model can be used as the replacement model of the deployment. :rtype: Tuple[str, str, Dict[str, Any]]

Added in version v2.17.

Parameters:
new_model_idOptional[str]

the id of the new model to validate

new_registered_model_version_idOptional[str]

(new in version 3.4) The registered model version (model package) ID of the new model to use.

Returns:
statusstr

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.

messagestr

message for the validation result

checksdict

explain why the new model can or cannot replace the deployment’s current model

get_features()

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

Returns:
features: list

a list of feature dict

Return type:

List[FeatureDict]

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.

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(data, batch_size=10000)

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

Parameters:
data: list or pandas.DataFrame
batch_size: the max number of actuals in each request
If `data` is a list, each item should be a dict-like object with the following keys and
values; if `data` is a pandas.DataFrame, it should contain the following columns:
- association_id: str, a unique identifier used with a prediction,

max length 128 characters

- actual_value: str or int or float, the actual value of a prediction;

should be numeric for deployments with regression models or string for deployments with classification model

- was_acted_on: bool, optional, indicates if the prediction was acted on in a way that

could have affected the actual outcome

- timestamp: datetime or string in RFC3339 format, optional. If the datetime provided

does not have a timezone, we assume it is UTC.

Raises:
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(dataset_id, actual_value_column, association_id_column, dataset_version_id=None, timestamp_column=None, was_acted_on_column=None)

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

Parameters:
dataset_id: str,

The ID of the source dataset.

dataset_version_id: str, optional

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: str, optional,

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: str, optional,

The name of the column that contains datetime or string in RFC3339 format.

Returns:
status_check_jobStatusCheckJob

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

Raises:
ValueError

if dataset_id not provided if actual_value_column not provided if association_id_column not provided

Return type:

StatusCheckJob

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()

Retrieve predictions by forecast date settings of this deployment. :rtype: ForecastDateSettings

Added in version v2.27.

Returns:
settingsdict

Predictions by forecast date settings of the deployment is a dict with the following format:

enabledbool

Is ‘’True’’ if predictions by forecast date is enabled for this deployment. To update this setting, see update_predictions_by_forecast_date_settings()

column_namestring

The column name in prediction datasets to be used as forecast date.

datetime_formatstring

The datetime format of the forecast date column in prediction datasets.

update_predictions_by_forecast_date_settings(enable_predictions_by_forecast_date, forecast_date_column_name=None, forecast_date_format=None, max_wait=600)

Update predictions by forecast date settings of this deployment. :rtype: None

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.

Parameters:
enable_predictions_by_forecast_datebool

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_waitint, optional

seconds to wait for successful

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",
)
get_challenger_models_settings()

Retrieve challenger models settings of this deployment. :rtype: ChallengerModelsSettings

Added in version v2.27.

Returns:
settingsdict

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

enabledbool

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

update_challenger_models_settings(challenger_models_enabled, max_wait=600)

Update challenger models settings of this deployment. :rtype: None

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

set to ‘’True’’ if challenger models is to be turned on or set to ‘’False’’ if challenger models is to be turned off

max_waitint, optional

seconds to wait for successful resolution

get_segment_analysis_settings()

Retrieve segment analysis settings of this deployment. :rtype: SegmentAnalysisSettings

Added in version v2.27.

Returns:
settingsdict

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

enabledbool

Set to ‘’True’’ if segment analysis is enabled for this deployment. To update existing setting, see update_segment_analysis_settings()

attributeslist

To create or update existing segment analysis attributes, see update_segment_analysis_settings()

update_segment_analysis_settings(segment_analysis_enabled, segment_analysis_attributes=None, max_wait=600)

Update segment analysis settings of this deployment. :rtype: None

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

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: list, optional

A list of strings that gives the segment attributes selected for tracking.

max_waitint, optional

seconds to wait for successful resolution

get_bias_and_fairness_settings()

Retrieve bias and fairness settings of this deployment.

..versionadded:: v3.2.0

Returns:
settingsdict in the following format:
protected_featuresList[str]

A list of features to mark as protected.

preferable_target_valuebool

A target value that should be treated as a positive outcome for the prediction.

fairness_metric_setstr

Can be one of <datarobot.enums.FairnessMetricsSet>. A set of fairness metrics to use for calculating fairness.

fairness_thresholdfloat

Threshold value of the fairness metric. Cannot be less than 0 or greater than 1.

Return type:

Optional[BiasAndFairnessSettings]

update_bias_and_fairness_settings(protected_features, fairness_metric_set, fairness_threshold, preferable_target_value, max_wait=600)

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:
protected_featuresList[str]

A list of features to mark as protected.

preferable_target_valuebool

A target value that should be treated as a positive outcome for the prediction.

fairness_metric_setstr

Can be one of <datarobot.enums.FairnessMetricsSet>. The fairness metric used to calculate the fairness scores.

fairness_thresholdfloat

Threshold value of the fairness metric. Cannot be less than 0 or greater than 1.

max_waitint, optional

seconds to wait for successful resolution

Return type:

None

get_challenger_replay_settings()

Retrieve challenger replay settings of this deployment. :rtype: ChallengerReplaySettings

Added in version v3.4.

Returns:
settingsdict in the following format:
enabledbool

If challenger replay is enabled. To update existing ‘’challenger_replay’’ settings, see update_challenger_replay_settings()

scheduleSchedule

The recurring schedule for the challenger replay job.

update_challenger_replay_settings(enabled, schedule=None)

Update challenger replay settings of this deployment. :rtype: None

Added in version v3.4.

Parameters:
enabledbool

If challenger replay is enabled.

scheduleOptional[Schedule]

The recurring schedule for the challenger replay job.

get_drift_tracking_settings()

Retrieve drift tracking settings of this deployment. :rtype: DriftTrackingSettings

Added in version v2.17.

Returns:
settingsdict

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

Target drift setting contains:

enabledbool

If target drift tracking is enabled for this deployment. To create or update existing ‘’target_drift’’ settings, see update_drift_tracking_settings()

Feature drift setting contains:

enabledbool

If feature drift tracking is enabled for this deployment. To create or update existing ‘’feature_drift’’ settings, see update_drift_tracking_settings()

update_drift_tracking_settings(target_drift_enabled=None, feature_drift_enabled=None, max_wait=600)

Update drift tracking settings of this deployment. :rtype: None

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:
target_drift_enabledbool, optional

if target drift tracking is to be turned on

feature_drift_enabledbool, optional

if feature drift tracking is to be turned on

max_waitint, optional

seconds to wait for successful resolution

get_association_id_settings()

Retrieve association ID setting for this deployment. :rtype: str

Added in version v2.19.

Returns:
association_id_settingsdict in the following format:
column_nameslist[string], optional

name of the columns to be used as association ID,

required_in_prediction_requestsbool, optional

whether the association ID column is required in prediction requests

update_association_id_settings(column_names=None, required_in_prediction_requests=None, max_wait=600)

Update association ID setting for this deployment. :rtype: None

Added in version v2.19.

Parameters:
column_nameslist[string], optional

name of the columns to be used as association ID, currently only support a list of one string

required_in_prediction_requestsbool, optional

whether the association ID column is required in prediction requests

max_waitint, optional

seconds to wait for successful resolution

get_predictions_data_collection_settings()

Retrieve predictions data collection settings of this deployment. :rtype: Dict[str, bool]

Added in version v2.21.

Returns:
predictions_data_collection_settingsdict in the following format:
enabledbool

If predictions data collection is enabled for this deployment. To update existing ‘’predictions_data_collection’’ settings, see update_predictions_data_collection_settings()

update_predictions_data_collection_settings(enabled, max_wait=600)

Update predictions data collection settings of this deployment. :rtype: None

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:
enabled: bool

if predictions data collection is to be turned on

max_waitint, optional

seconds to wait for successful resolution

get_prediction_warning_settings()

Retrieve prediction warning settings of this deployment. :rtype: PredictionWarningSettings

Added in version v2.19.

Returns:
settingsdict in the following format:
enabledbool

If target prediction_warning is enabled for this deployment. To create or update existing ‘’prediction_warning’’ settings, see update_prediction_warning_settings()

custom_boundariesdict or None
If None default boundaries for a model are used. Otherwise has following keys:
upperfloat

All predictions greater than provided value are considered anomalous

lowerfloat

All predictions less than provided value are considered anomalous

update_prediction_warning_settings(prediction_warning_enabled, use_default_boundaries=None, lower_boundary=None, upper_boundary=None, max_wait=600)

Update prediction warning settings of this deployment. :rtype: None

Added in version v2.19.

Parameters:
prediction_warning_enabledbool

If prediction warnings should be turned on.

use_default_boundariesbool, optional

If default boundaries of the model should be used for the deployment.

upper_boundaryfloat, optional

All predictions greater than provided value will be considered anomalous

lower_boundaryfloat, optional

All predictions less than provided value will be considered anomalous

max_waitint, optional

seconds to wait for successful resolution

get_prediction_intervals_settings()

Retrieve prediction intervals settings for this deployment. :rtype: PredictionIntervalsSettings

Added in version v2.19.

Returns:
dict in the following format:
enabledbool

Whether prediction intervals are enabled for this deployment

percentileslist[int]

List of enabled prediction intervals’ sizes for this deployment. Currently we only support one percentile at a time.

Notes

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

update_prediction_intervals_settings(percentiles, enabled=True, max_wait=600)

Update prediction intervals settings for this deployment. :rtype: None

Added in version v2.19.

Parameters:
percentileslist[int]

The prediction intervals percentiles to enable for this deployment. Currently we only support setting one percentile at a time.

enabledbool, optional (defaults to True)

Whether to enable showing prediction intervals in the results of predictions requested using this deployment.

max_waitint, optional

seconds to wait for successful resolution

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

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.

get_health_settings()

Retrieve health settings of this deployment. :rtype: HealthSettings

Added in version v3.4.

Returns:
settingsdict in the following format:
servicedict

Service health settings.

data_driftdict

Data drift health settings.

accuracydict

Accuracy health settings.

fairnessdict

Fairness health settings.

custom_metricsdict

Custom metrics health settings.

predictions_timelinessdict

Predictions timeliness health settings.

actuals_timelinessdict

Actuals timeliness health settings.

update_health_settings(service=None, data_drift=None, accuracy=None, fairness=None, custom_metrics=None, predictions_timeliness=None, actuals_timeliness=None)

Update health settings of this deployment. :rtype: HealthSettings

Added in version v3.4.

Parameters:
servicedict

Service health settings.

data_driftdict

Data drift health settings.

accuracydict

Accuracy health settings.

fairnessdict

Fairness health settings.

custom_metricsdict

Custom metrics health settings.

predictions_timelinessdict

Predictions timeliness health settings.

actuals_timelinessdict

Actuals timeliness health settings.

get_default_health_settings()

Retrieve default health settings of this deployment. :rtype: HealthSettings

Added in version v3.4.

Returns:
settingsdict in the following format:
servicedict

Service health settings.

data_driftdict

Data drift health settings.

accuracydict

Accuracy health settings.

fairnessdict

Fairness health settings.

custom_metricsdict

Custom metrics health settings.

predictions_timelinessdict

Predictions timeliness health settings.

actuals_timelinessdict

Actuals timeliness health settings.

get_service_stats(model_id=None, start_time=None, end_time=None, execution_time_quantile=None, response_time_quantile=None, slow_requests_threshold=None, segment_attribute=None, segment_value=None)

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

Added in version v2.18.

Parameters:
model_idstr, optional

the id of the model

start_timedatetime, optional

start of the time period

end_timedatetime, optional

end of the time period

execution_time_quantilefloat, optional

quantile for executionTime, defaults to 0.5

response_time_quantilefloat, optional

quantile for responseTime, defaults to 0.5

slow_requests_thresholdfloat, optional

threshold for slowRequests, defaults to 1000

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
service_statsServiceStats

the queried service stats metrics information

get_service_stats_over_time(metric=None, model_id=None, start_time=None, end_time=None, bucket_size=None, quantile=None, threshold=None, segment_attribute=None, segment_value=None)

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

Added in version v2.18.

Parameters:
metricSERVICE_STAT_METRIC, optional

the service stat metric to retrieve

model_idstr, optional

the id of the model

start_timedatetime, optional

start of the time period

end_timedatetime, optional

end of the time period

bucket_sizestr, optional

time duration of a bucket, in ISO 8601 time duration format

quantilefloat, optional

quantile for ‘executionTime’ or ‘responseTime’, ignored when querying other metrics

thresholdint, optional

threshold for ‘slowQueries’, ignored when querying other metrics

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
service_stats_over_timeServiceStatsOverTime

the queried service stats metric over time information

get_target_drift(model_id=None, start_time=None, end_time=None, metric=None, segment_attribute=None, segment_value=None)

Retrieve target drift information over a certain time period. :rtype: TargetDrift

Added in version v2.21.

Parameters:
model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

metricstr

(New in version v2.22) metric used to calculate the drift score

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
target_driftTargetDrift

the queried target drift information

get_feature_drift(model_id=None, start_time=None, end_time=None, metric=None, segment_attribute=None, segment_value=None)

Retrieve drift information for deployment’s features over a certain time period. :rtype: List[FeatureDrift]

Added in version v2.21.

Parameters:
model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

metricstr

(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_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns
——-
feature_drift_data[FeatureDrift]

the queried feature drift information

get_predictions_over_time(model_ids=None, start_time=None, end_time=None, bucket_size=None, target_classes=None, include_percentiles=False, segment_attribute=None, segment_value=None)

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

Added in version v3.2.

Parameters:
model_idslist[str]

ID of models to retrieve prediction stats

start_timedatetime

start of the time period

end_timedatetime

end of the time period

bucket_sizeBUCKET_SIZE

time duration of each bucket

target_classeslist[str]

class names of target, only for deployments with multiclass target

include_percentilesbool

if the returned data includes percentiles, only for a deployment with a binary and regression target

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
predictions_over_timePredictionsOverTime

the queried predictions over time information

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(model_id=None, start_time=None, end_time=None, start=None, end=None, target_classes=None, segment_attribute=None, segment_value=None)

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

Added in version v2.18.

Parameters:
model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

target_classeslist[str], optional

Optional list of target class strings

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
accuracyAccuracy

the queried accuracy metrics information

get_accuracy_over_time(metric=None, model_id=None, start_time=None, end_time=None, bucket_size=None, target_classes=None, segment_attribute=None, segment_value=None)

Retrieves values of a single accuracy metric over a time period. :rtype: AccuracyOverTime

Added in version v2.18.

Parameters:
metricACCURACY_METRIC

the accuracy metric to retrieve

model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

bucket_sizestr

time duration of a bucket, in ISO 8601 time duration format

target_classeslist[str], optional

Optional list of target class strings

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
accuracy_over_timeAccuracyOverTime

the queried accuracy metric over time information

get_predictions_vs_actuals_over_time(model_ids=None, start_time=None, end_time=None, bucket_size=None, target_classes=None, segment_attribute=None, segment_value=None)

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

Added in version v3.3.

Parameters:
model_idslist[str]

The ID of models to retrieve predictions vs actuals stats for.

start_timedatetime

Start of the time period.

end_timedatetime

End of the time period.

bucket_sizeBUCKET_SIZE

Time duration of each bucket.

target_classeslist[str]

Class names of target, only for deployments with a multiclass target.

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
predictions_vs_actuals_over_timePredictionsVsActualsOverTime

The queried predictions vs actuals over time information.

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(start_time=None, end_time=None, bucket_size=None, model_id=None, protected_feature=None, fairness_metric=None)

Retrieves values of a single fairness score over a time period. :rtype: FairnessScoresOverTime

Added in version v3.2.

Parameters:
model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

bucket_sizestr

time duration of a bucket, in ISO 8601 time duration format

protected_featurestr

name of protected feature

fairness_metricstr

A consolidation of the fairness metrics by the use case.

Returns:
fairness_scores_over_timeFairnessScoresOverTime

the queried fairness score over time information

update_secondary_dataset_config(secondary_dataset_config_id, credential_ids=None)

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

Added in version v2.23.

Parameters:
secondary_dataset_config_id: str

Id of the secondary dataset config

credential_ids: list or None

List of DatasetsCredentials used by the secondary datasets

Examples

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

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

Added in version v2.23.

Returns:
secondary_dataset_configSecondaryDatasetConfigurations

Id of the secondary dataset config

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(model_id=None, start_time=None, end_time=None, actuals_present=None, offset=None, limit=None)

Retrieve a list of prediction results of the deployment. :rtype: List[Dict[str, Any]]

Added in version v2.24.

Parameters:
model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

actuals_presentbool

filters predictions results to only those who have actuals present or with missing actuals

offsetint

this many results will be skipped

limitint

at most this many results are returned

Returns:
prediction_results: list[dict]

a list of prediction results

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
results = deployment.get_prediction_results()
download_prediction_results(filepath, model_id=None, start_time=None, end_time=None, actuals_present=None, offset=None, limit=None)

Download prediction results of the deployment as a CSV file. :rtype: None

Added in version v2.24.

Parameters:
filepathstr

path of the csv file

model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

actuals_presentbool

filters predictions results to only those who have actuals present or with missing actuals

offsetint

this many results will be skipped

limitint

at most this many results are returned

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
results = deployment.download_prediction_results('path_to_prediction_results.csv')
download_scoring_code(filepath, source_code=False, include_agent=False, include_prediction_explanations=False, include_prediction_intervals=False, max_wait=600)

Retrieve scoring code of the current deployed model. :rtype: None

Added in version v2.24.

Parameters:
filepathstr

path of the scoring code file

source_codebool

whether source code or binary of the scoring code will be retrieved

include_agentbool

whether the scoring code retrieved will include tracking agent

include_prediction_explanationsbool

whether the scoring code retrieved will include prediction explanations

include_prediction_intervalsbool

whether the scoring code retrieved will support prediction intervals

max_wait: int, optional

Seconds to wait for successful resolution of a deployment creation job. Deployment supports making predictions only after a deployment creating job has successfully finished

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.

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(filepath, compute_all_ts_intervals=False)

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

Added in version v3.3.

Parameters:
filepathstr

The file path of the model package file.

compute_all_ts_intervalsbool

Includes all time series intervals into the built Model Package (.mlpkg) if set to True.

Examples

from datarobot import Deployment
deployment = Deployment.get(deployment_id='5c939e08962d741e34f609f0')
deployment.download_model_package_file('path_to_model_package.mlpkg')
delete_monitoring_data(model_id, start_time=None, end_time=None, max_wait=600)

Delete deployment monitoring data.

Parameters:
model_idstr

id of the model to delete monitoring data

start_timedatetime, optional

start of the time period to delete monitoring data

end_timedatetime, optional

end of the time period to delete monitoring data

max_waitint, optional

seconds to wait for successful resolution

Return type:

None

list_shared_roles(id=None, name=None, share_recipient_type=None, limit=100, offset=0)

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

Parameters:
id: str, Optional

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.

Returns:
List[DeploymentSharedRole]
Return type:

List[DeploymentSharedRole]

update_shared_roles(roles)

Share a deployment with a user, group, or organization

Parameters:
roles: list(or(GrantAccessControlWithUsernameValidator, GrantAccessControlWithIdValidator))

Array of GrantAccessControl objects, up to maximum 100 objects.

Return type:

None

list_challengers()

Get a list of challengers for this deployment. :rtype: List[Challenger]

Added in version v3.4.

Returns:
list(Challenger)
get_champion_model_package()

Get a champion model package for this deployment.

Returns:
champion_model_packageChampionModelPackage

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(model_id=None, status=None, batch=None, offset=0, limit=100)

Retrieve a list of asynchronous prediction data exports.

Parameters:
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:
prediction_data_exports: List[PredictionDataExport]

A list of prediction data exports.

Return type:

List[PredictionDataExport]

list_actuals_data_exports(status=None, offset=0, limit=100)

Retrieve a list of asynchronous actuals data exports.

Parameters:
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:
actuals_data_exports: List[ActualsDataExport]

A list of actuals data exports.

Return type:

List[ActualsDataExport]

list_training_data_exports()

Retrieve a list of successful training data exports.

Returns:
training_data_export: List[TrainingDataExport]

A list of training data exports.

Return type:

List[TrainingDataExport]

list_data_quality_exports(start, end, model_id=None, prediction_pattern=None, prompt_pattern=None, actual_pattern=None, order_by=None, order_metric=None, filter_metric=None, filter_value=None, offset=0, limit=100)

Retrieve a list of data-quality export records for a given deployment. :rtype: List[DataQualityExport]

Added in version v3.6.

Parameters:
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:
data_quality_exports: list

A list of DataQualityExport objects.

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()

Get a list capabilities for this deployment. :rtype: List[Capability]

Added in version v3.5.

Returns:
list(Capability)

Examples

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

Get a list of segment attributes for this deployment. :rtype: List[str]

Added in version v3.6.

Parameters:
monitoringType: str, Optional

The monitoring type for which segment attributes are being retrieved.

Returns:
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(segment_attribute=None, limit=100, offset=0, search=None)

Get a list of segment values for this deployment. :rtype: List[str]

Added in version v3.6.

Parameters:
segment_attribute: str, Optional

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: str, Optional

A string to filter the values.

Returns:
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(limit=100, offset=0)

Get a list of moderation events for this deployment

Parameters:
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:
events: List[MLOpsEvent]
Return type:

List[MLOpsEvent]

classmethod from_data(data)

Instantiate an object of this class using a dict.

Parameters:
datadict

Correctly snake_cased keys and their values.

Return type:

TypeVar(T, bound= APIObject)

classmethod from_server_data(data, keep_attrs=None)

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

Parameters:
datadict

The directly translated dict of JSON from the server. No casing fixes have taken place

keep_attrsiterable

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()

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

class datarobot.models.deployment.DeploymentListFilters(role=None, service_health=None, model_health=None, accuracy_health=None, execution_environment_type=None, importance=None)
class datarobot.models.deployment.ServiceStats(period=None, metrics=None, model_id=None, segment_attribute=None, segment_value=None)

Deployment service stats information.

Attributes:
model_idstr

the model used to retrieve service stats metrics

perioddict

the time period used to retrieve service stats metrics

metricsdict

the service stats metrics

classmethod get(deployment_id, model_id=None, start_time=None, end_time=None, execution_time_quantile=None, response_time_quantile=None, segment_attribute=None, segment_value=None, slow_requests_threshold=None)

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

Added in version v2.18.

Parameters:
deployment_idstr

the id of the deployment

model_idstr, optional

the id of the model

start_timedatetime, optional

start of the time period

end_timedatetime, optional

end of the time period

execution_time_quantilefloat, optional

quantile for executionTime, defaults to 0.5

response_time_quantilefloat, optional

quantile for responseTime, defaults to 0.5

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

slow_requests_thresholdfloat, optional

threshold for slowRequests, defaults to 1000

Returns:
service_statsServiceStats

the queried service stats metrics

class datarobot.models.deployment.ServiceStatsOverTime(buckets=None, summary=None, metric=None, model_id=None, segment_attribute=None, segment_value=None)

Deployment service stats over time information.

Attributes:
model_idstr

the model used to retrieve accuracy metric

metricstr

the service stat metric being retrieved

bucketsdict

how the service stat metric changes over time

summarydict

summary for the service stat metric

classmethod get(deployment_id, metric=None, model_id=None, start_time=None, end_time=None, bucket_size=None, quantile=None, threshold=None, segment_attribute=None, segment_value=None)

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

Added in version v2.18.

Parameters:
deployment_idstr

the id of the deployment

metricSERVICE_STAT_METRIC, optional

the service stat metric to retrieve

model_idstr, optional

the id of the model

start_timedatetime, optional

start of the time period

end_timedatetime, optional

end of the time period

bucket_sizestr, optional

time duration of a bucket, in ISO 8601 time duration format

quantilefloat, optional

quantile for ‘executionTime’ or ‘responseTime’, ignored when querying other metrics

thresholdint, optional

threshold for ‘slowQueries’, ignored when querying other metrics

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
service_stats_over_timeServiceStatsOverTime

the queried service stat over time information

property bucket_values: OrderedDict[str, int | float | None]

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

Returns:
bucket_values: OrderedDict
class datarobot.models.deployment.TargetDrift(period=None, metric=None, model_id=None, target_name=None, drift_score=None, sample_size=None, baseline_sample_size=None, segment_attribute=None, segment_value=None)

Deployment target drift information.

Attributes:
model_idstr

the model used to retrieve target drift metric

perioddict

the time period used to retrieve target drift metric

metricstr

the data drift metric

target_namestr

name of the target

drift_scorefloat

target drift score

sample_sizeint

count of data points for comparison

baseline_sample_sizeint

count of data points for baseline

classmethod get(deployment_id, model_id=None, start_time=None, end_time=None, metric=None, segment_attribute=None, segment_value=None)

Retrieve target drift information over a certain time period. :rtype: TargetDrift

Added in version v2.21.

Parameters:
deployment_idstr

the id of the deployment

model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

metricstr

(New in version v2.22) metric used to calculate the drift score

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns
——-
target_driftTargetDrift

the queried target drift information

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'
class datarobot.models.deployment.FeatureDrift(period=None, metric=None, model_id=None, name=None, drift_score=None, feature_impact=None, sample_size=None, baseline_sample_size=None, segment_attribute=None, segment_value=None)

Deployment feature drift information.

Attributes:
model_idstr

the model used to retrieve feature drift metric

perioddict

the time period used to retrieve feature drift metric

metricstr

the data drift metric

namestr

name of the feature

drift_scorefloat

feature drift score

sample_sizeint

count of data points for comparison

baseline_sample_sizeint

count of data points for baseline

classmethod list(deployment_id, model_id=None, start_time=None, end_time=None, metric=None, segment_attribute=None, segment_value=None)

Retrieve drift information for deployment’s features over a certain time period. :rtype: List[FeatureDrift]

Added in version v2.21.

Parameters:
deployment_idstr

the id of the deployment

model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

metricstr

(New in version v2.22) metric used to calculate the drift score

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
feature_drift_data[FeatureDrift]

the queried feature drift information

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'
class datarobot.models.deployment.PredictionsOverTime(baselines=None, buckets=None)

Deployment predictions over time information.

Attributes:
baselinesList

target baseline for each model queried

bucketsList

predictions over time bucket for each model and bucket queried

classmethod get(deployment_id, model_ids=None, start_time=None, end_time=None, bucket_size=None, target_classes=None, include_percentiles=False, segment_attribute=None, segment_value=None)

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

Added in version v3.2.

Parameters:
deployment_idstr

the id of the deployment

model_idslist[str]

ID of models to retrieve prediction stats

start_timedatetime

start of the time period

end_timedatetime

end of the time period

bucket_sizeBUCKET_SIZE

time duration of each bucket

target_classeslist[str]

class names of target, only for deployments with multiclass target

include_percentilesbool

if the returned data includes percentiles, only for a deployment with a binary and regression target

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
predictions_over_timePredictionsOverTime

the queried predictions over time information

class datarobot.models.deployment.Accuracy(period=None, metrics=None, model_id=None)

Deployment accuracy information.

Attributes:
model_idstr

the model used to retrieve accuracy metrics

perioddict

the time period used to retrieve accuracy metrics

metricsdict

the accuracy metrics

classmethod get(deployment_id, model_id=None, start_time=None, end_time=None, target_classes=None, segment_attribute=None, segment_value=None)

Retrieve values of accuracy metrics over a certain time period. :rtype: Accuracy

Added in version v2.18.

Parameters:
deployment_idstr

the id of the deployment

model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

target_classeslist[str], optional

Optional list of target class strings

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
accuracyAccuracy

the queried accuracy metrics information

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
property metric_values: Dict[str, int | None]

The value for all metrics, keyed by metric name.

Returns:
metric_values: Dict
property metric_baselines: Dict[str, int | None]

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

Returns:
metric_baselines: Dict
property percent_changes: Dict[str, int | None]

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

Returns:
percent_changes: Dict
class datarobot.models.deployment.AccuracyOverTime(buckets=None, summary=None, baseline=None, metric=None, model_id=None, segment_attribute=None, segment_value=None)

Deployment accuracy over time information.

Attributes:
model_idstr

the model used to retrieve accuracy metric

metricstr

the accuracy metric being retrieved

bucketsdict

how the accuracy metric changes over time

summarydict

summary for the accuracy metric

baselinedict

baseline for the accuracy metric

classmethod get(deployment_id, metric=None, model_id=None, start_time=None, end_time=None, bucket_size=None, target_classes=None, segment_attribute=None, segment_value=None)

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

Added in version v2.18.

Parameters:
deployment_idstr

the id of the deployment

metricACCURACY_METRIC

the accuracy metric to retrieve

model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

bucket_sizestr

time duration of a bucket, in ISO 8601 time duration format

target_classeslist[str], optional

Optional list of target class strings

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
accuracy_over_timeAccuracyOverTime

the queried accuracy metric over time information

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}
classmethod get_as_dataframe(deployment_id, metrics=None, model_id=None, start_time=None, end_time=None, bucket_size=None)

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

the id of the deployment

metrics[ACCURACY_METRIC]

the accuracy metrics to retrieve

model_idstr

the id of the model

start_timedatetime

start of the time period

end_timedatetime

end of the time period

bucket_sizestr

time duration of a bucket, in ISO 8601 time duration format

Returns:
accuracy_over_time: pd.DataFrame
Return type:

DataFrame

property bucket_values: Dict[datetime, int]

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

Returns:
bucket_values: Dict
property bucket_sample_sizes: Dict[datetime, int]

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

Returns:
bucket_sample_sizes: Dict
class datarobot.models.deployment.PredictionsVsActualsOverTime(summary=None, baselines=None, buckets=None, segment_attribute=None, segment_value=None)

Deployment predictions vs actuals over time information.

Attributes:
summarydict

predictions vs actuals over time summary for all models and buckets queried

baselinesList

target baseline for each model queried

bucketsList

predictions vs actuals over time bucket for each model and bucket queried

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

classmethod get(deployment_id, model_ids=None, start_time=None, end_time=None, bucket_size=None, target_classes=None, segment_attribute=None, segment_value=None)

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

Added in version v3.3.

Parameters:
deployment_idstr

the id of the deployment

model_idslist[str]

ID of models to retrieve predictions vs actuals stats

start_timedatetime

start of the time period

end_timedatetime

end of the time period

bucket_sizeBUCKET_SIZE

time duration of each bucket

target_classeslist[str]

class names of target, only for deployments with multiclass target

segment_attributestr, optional

(New in Version v3.6) the segment attribute

segment_valuestr, optional

(New in Version v3.6) the segment value

Returns:
predictions_vs_actuals_over_timePredictionsVsActualsOverTime

the queried predictions vs actuals over time information

class datarobot.models.deployment.bias_and_fairness.FairnessScoresOverTime(summary=None, buckets=None, protected_feature=None, fairness_threshold=None, model_id=None, model_package_id=None, favorable_target_outcome=None)

Deployment fairness over time information.

Attributes:
bucketsList

fairness over time bucket for each model and bucket queried

summarydict

summary for the fairness score

protected_featurestr

name of protected feature

fairnessThresholdfloat

threshold used to compute fairness results

modelIdstr

model id for which fairness is computed

modelPackageIdstr

model package (version) id for which fairness is computed

favorableTargetOutcomebool

preferable class of the target

classmethod get(deployment_id, model_id=None, start_time=None, end_time=None, bucket_size=None, fairness_metric=None, protected_feature=None)

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

Added in version FUTURE.

Parameters:
deployment_idstr

the id of the deployment

model_idstr

id of models to retrieve fairness score stats

start_timedatetime

start of the time period

end_timedatetime

end of the time period

protected_featurestr

name of the protected feature

fairness_metricstr

A consolidation of the fairness metrics by the use case.

bucket_sizeBUCKET_SIZE

time duration of each bucket

Returns:
fairness_scores_over_timeFairnessScoresOverTime

the queried fairness score over time information

class datarobot.models.deployment.DeploymentSharedRole(id, name, role, share_recipient_type, **kwargs)
Parameters:
share_recipient_type: enum(‘user’, ‘group’, ‘organization’)

Describes the recipient type, either user, group, or organization.

role: str, one of enum(‘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: string

The name of the recipient organization, group or user.

class datarobot.models.deployment.DeploymentGrantSharedRoleWithId(id, role, share_recipient_type='user', **kwargs)
Parameters:
share_recipient_type: enum(‘user’, ‘group’, ‘organization’)

Describes the recipient type, either user, group, or organization.

role: enum(‘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.

class datarobot.models.deployment.DeploymentGrantSharedRoleWithUsername(role, username, **kwargs)
Parameters:
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.

class datarobot.models.deployment.deployment.FeatureDict(*args, **kwargs)
class datarobot.models.deployment.deployment.ForecastDateSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.ChallengerModelsSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.SegmentAnalysisSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.BiasAndFairnessSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.ChallengerReplaySettings(*args, **kwargs)
class datarobot.models.deployment.deployment.HealthSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.DriftTrackingSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.PredictionWarningSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.PredictionIntervalsSettings(*args, **kwargs)
class datarobot.models.deployment.deployment.Capability(*args, **kwargs)