Registered Model

class datarobot.models.RegisteredModel(id, name, description, created_at, modified_at, target, created_by, last_version_num, is_archived, modified_by=None)

A registered model is a logical grouping of model packages (versions) that are related to each other.

Attributes:
idstr

The ID of the registered model.

namestr

The name of the registered model.

descriptionstr

The description of the registered model.

created_atstr

The creation time of the registered model.

modified_atstr

The last modification time for the registered model.

modified_bydatarobot.models.model_registry.common.UserMetadata

Information on the user who last modified the registered model.

targetTarget

Information on the target variable.

created_bydatarobot.models.model_registry.common.UserMetadata

Information on the creator of the registered model.

last_version_numint

The latest version number associated to this registered model.

is_archivedbool

Determines whether the registered model is archived.

classmethod get(registered_model_id)

Get a registered model by ID.

Parameters:
registered_model_idstr

ID of the registered model to retrieve

Returns:
registered_modelRegisteredModel

Registered Model Object

Return type:

TypeVar(TRegisteredModel, bound= RegisteredModel)

Examples

from datarobot import RegisteredModel
registered_model = RegisteredModel.get(registered_model_id='5c939e08962d741e34f609f0')
registered_model.id
>>>'5c939e08962d741e34f609f0'
registered_model.name
>>>'My Registered Model'
classmethod list(limit=100, offset=None, sort_key=None, sort_direction=None, search=None, filters=None)

List all registered models a user can view.

Parameters:
limitint, optional

Maximum number of registered models to return

offsetint, optional

Number of registered models to skip before returning results

sort_keyRegisteredModelSortKey, optional

Key to order result by

sort_directionRegisteredModelSortDirection, optional

Sort direction

searchstr, optional

A term to search for in registered model name, description, or target name

filtersRegisteredModelListFilters, optional

An object containing all filters that you’d like to apply to the resulting list of registered models.

Returns
——-
registered_modelsList[RegisteredModel]

A list of registered models user can view.

Return type:

List[TypeVar(TRegisteredModel, bound= RegisteredModel)]

Examples

from datarobot import RegisteredModel
registered_models = RegisteredModel.list()
>>> [RegisteredModel('My Registered Model'), RegisteredModel('My Other Registered Model')]
from datarobot import RegisteredModel
from datarobot.models.model_registry import RegisteredModelListFilters
from datarobot.enums import RegisteredModelSortKey, RegisteredModelSortDirection
filters = RegisteredModelListFilters(target_type='Regression')
registered_models = RegisteredModel.list(
    filters=filters,
    sort_key=RegisteredModelSortKey.NAME.value,
    sort_direction=RegisteredModelSortDirection.DESC.value
    search='other')
>>> [RegisteredModel('My Other Registered Model')]
classmethod archive(registered_model_id)

Permanently archive a registered model and all of its versions.

Parameters:
registered_model_idstr

ID of the registered model to be archived

Returns:
Return type:

None

classmethod update(registered_model_id, name)

Update the name of a registered model.

Parameters:
registered_model_idstr

ID of the registered model to be updated

namestr

New name for the registered model

Returns:
registered_modelRegisteredModel

Updated registered model object

Return type:

TypeVar(TRegisteredModel, bound= RegisteredModel)

get_shared_roles(offset=None, limit=None, id=None)

Retrieve access control information for this registered model.

Parameters:
offsetOptional[int]

The number of records to skip over. Optional. Default is 0.

limit: Optional[int]

The number of records to return. Optional. Default is 100.

id: Optional[str]

Return the access control information for a user with this user ID. Optional.

Return type:

List[SharingRole]

share(roles)

Share this registered model or remove access from one or more user(s).

Parameters:
rolesList[SharingRole]

A list of SharingRole instances, each of which references a user and a role to be assigned.

Return type:

None

Examples

>>> from datarobot import RegisteredModel, SharingRole
>>> from datarobot.enums import SHARING_ROLE, SHARING_RECIPIENT_TYPE
>>> registered_model = RegisteredModel.get('5c939e08962d741e34f609f0')
>>> sharing_role = SharingRole(
...    role=SHARING_ROLE.CONSUMER,
...    recipient_type=SHARING_RECIPIENT_TYPE.USER,
...    id='5c939e08962d741e34f609f0',
...    can_share=True,
...    )
>>> registered_model.share(roles=[sharing_role])
get_version(version_id)

Retrieve a registered model version.

Parameters:
version_idstr

The ID of the registered model version to retrieve.

Returns:
registered_model_versionRegisteredModelVersion

A registered model version object.

Return type:

RegisteredModelVersion

Examples

from datarobot import RegisteredModel
registered_model = RegisteredModel.get('5c939e08962d741e34f609f0')
registered_model_version = registered_model.get_version('5c939e08962d741e34f609f0')
>>> RegisteredModelVersion('My Registered Model Version')
list_versions(filters=None, search=None, sort_key=None, sort_direction=None, limit=None, offset=None)

Retrieve a list of registered model versions.

Parameters:
filtersOptional[RegisteredModelVersionsListFilters]

A RegisteredModelVersionsListFilters instance used to filter the list of registered model versions returned.

searchOptional[str]

A search string used to filter the list of registered model versions returned.

sort_keyOptional[RegisteredModelVersionSortKey]

The key to use to sort the list of registered model versions returned.

sort_directionOptional[RegisteredModelSortDirection]

The direction to use to sort the list of registered model versions returned.

limitOptional[int]

The maximum number of registered model versions to return. Default is 100.

offsetOptional[int]

The number of registered model versions to skip over. Default is 0.

Returns:
registered_model_versionsList[RegisteredModelVersion]

A list of registered model version objects.

Return type:

List[RegisteredModelVersion]

Examples

from datarobot import RegisteredModel
from datarobot.models.model_registry import RegisteredModelVersionsListFilters
from datarobot.enums import RegisteredModelSortKey, RegisteredModelSortDirection
registered_model = RegisteredModel.get('5c939e08962d741e34f609f0')
filters = RegisteredModelVersionsListFilters(tags=['tag1', 'tag2'])
registered_model_versions = registered_model.list_versions(filters=filters)
>>> [RegisteredModelVersion('My Registered Model Version')]
list_associated_deployments(search=None, sort_key=None, sort_direction=None, limit=None, offset=None)

Retrieve a list of deployments associated with this registered model.

Parameters:
searchOptional[str]
sort_keyOptional[RegisteredModelDeploymentSortKey]
sort_directionOptional[RegisteredModelSortDirection]
limitOptional[int]
offsetOptional[int]
Returns:
deploymentsList[VersionAssociatedDeployment]

A list of deployments associated with this registered model.

Return type:

List[VersionAssociatedDeployment]

class datarobot.models.RegisteredModelVersion(id, registered_model_id, registered_model_version, name, model_id, model_execution_type, is_archived, import_meta, source_meta, model_kind, target, model_description, datasets, timeseries, is_deprecated, permissions, active_deployment_count, bias_and_fairness=None, build_status=None, user_provided_id=None, updated_at=None, updated_by=None, tags=None, mlpkg_file_contents=None)

Represents a version of a registered model.

Parameters:
idstr

The ID of the registered model version.

registered_model_idstr

The ID of the parent registered model.

registered_model_versionint

The version of the registered model.

namestr

The name of the registered model version.

model_idstr

The ID of the model.

model_execution_typestr

Type of model package (version). dedicated (native DataRobot models) and custom_inference_model` (user added inference models) both execute on DataRobot prediction servers, external do not

is_archivedbool
Whether the model package (version) is permanently archived (cannot be used in deployment or

replacement)

import_metaImportMeta

Information from when this Model Package (version) was first saved.

source_metaSourceMeta

Meta information from where this model was generated

model_kindModelKind

Model attribute information.

targetTarget

Target information for the registered model version.

model_descriptionModelDescription

Model description information.

datasetsDataset

Dataset information for the registered model version.

timeseriesTimeseries

Timeseries information for the registered model version.

bias_and_fairnessBiasAndFairness

Bias and fairness information for the registered model version.

is_deprecatedbool
Whether the model package (version) is deprecated (cannot be used in deployment or

replacement)

permissionsList[str]

Permissions for the registered model version.

active_deployment_countint or None

Number of the active deployments associated with the registered model version.

build_statusstr or None

Model package (version) build status. One of complete, inProgress, failed.

user_provided_idstr or None

User provided ID for the registered model version.

updated_atstr or None

The time the registered model version was last updated.

updated_byUserMetadata or None

The user who last updated the registered model version.

tagsList[TagWithId] or None

The tags associated with the registered model version.

mlpkg_file_contentsstr or None

The contents of the model package file.

classmethod create_for_leaderboard_item(model_id, name=None, prediction_threshold=None, distribution_prediction_model_id=None, description=None, compute_all_ts_intervals=None, registered_model_name=None, registered_model_id=None, tags=None, registered_model_tags=None, registered_model_description=None)
Parameters:
model_idstr

ID of the DataRobot model.

namestr or None

Name of the version (model package).

prediction_thresholdfloat or None

Threshold used for binary classification in predictions.

distribution_prediction_model_idstr or None

ID of the DataRobot distribution prediction model trained on predictions from the DataRobot model.

descriptionstr or None

Description of the version (model package).

compute_all_ts_intervalsbool or None

Whether to compute all time series prediction intervals (1-100 percentiles).

registered_model_nameOptional[str]

Name of the new registered model that will be created from this model package (version). The model package (version) will be created as version 1 of the created registered model. If neither registeredModelName nor registeredModelId is provided, it defaults to the model package (version) name. Mutually exclusive with registeredModelId.

registered_model_idOptional[str]

Creates a model package (version) as a new version for the provided registered model ID. Mutually exclusive with registeredModelName.

tagsOptional[List[Tag]]

Tags for the registered model version.

registered_model_tags: Optional[List[Tag]]

Tags for the registered model.

registered_model_description: Optional[str]

Description for the registered model.

Returns:
regitered_model_versionRegisteredModelVersion

A new registered model version object.

Return type:

TypeVar(TRegisteredModelVersion, bound= RegisteredModelVersion)

classmethod create_for_external(name, target, model_id=None, model_description=None, datasets=None, timeseries=None, registered_model_name=None, registered_model_id=None, tags=None, registered_model_tags=None, registered_model_description=None)

Create a new registered model version from an external model.

Parameters:
namestr

Name of the registered model version.

targetExternalTarget

Target information for the registered model version.

model_idOptional[str]

Model ID of the registered model version.

model_descriptionOptional[ModelDescription]

Information about the model.

datasetsOptional[ExternalDatasets]

Dataset information for the registered model version.

timeseriesOptional[Timeseries]

Timeseries properties for the registered model version.

registered_model_nameOptional[str]

Name of the new registered model that will be created from this model package (version). The model package (version) will be created as version 1 of the created registered model. If neither registeredModelName nor registeredModelId is provided, it defaults to the model package (version) name. Mutually exclusive with registeredModelId.

registered_model_idOptional[str]

Creates a model package (version) as a new version for the provided registered model ID. Mutually exclusive with registeredModelName.

tagsOptional[List[Tag]]

Tags for the registered model version.

registered_model_tags: Optional[List[Tag]]

Tags for the registered model.

registered_model_description: Optional[str]

Description for the registered model.

Returns:
registered_model_versionRegisteredModelVersion

A new registered model version object.

Return type:

TypeVar(TRegisteredModelVersion, bound= RegisteredModelVersion)

classmethod create_for_custom_model_version(custom_model_version_id, name=None, description=None, registered_model_name=None, registered_model_id=None, tags=None, registered_model_tags=None, registered_model_description=None)

Create a new registered model version from a custom model version.

Parameters:
custom_model_version_idstr

ID of the custom model version.

nameOptional[str]

Name of the registered model version.

descriptionOptional[str]

Description of the registered model version.

registered_model_nameOptional[str]

Name of the new registered model that will be created from this model package (version). The model package (version) will be created as version 1 of the created registered model. If neither registeredModelName nor registeredModelId is provided, it defaults to the model package (version) name. Mutually exclusive with registeredModelId.

registered_model_idOptional[str]

Creates a model package (version) as a new version for the provided registered model ID. Mutually exclusive with registeredModelName.

tagsOptional[List[Tag]]

Tags for the registered model version.

registered_model_tags: Optional[List[Tag]]

Tags for the registered model.

registered_model_description: Optional[str]

Description for the registered model.

Returns:
registered_model_versionRegisteredModelVersion

A new registered model version object.

Return type:

TypeVar(TRegisteredModelVersion, bound= RegisteredModelVersion)

list_associated_deployments(search=None, sort_key=None, sort_direction=None, limit=None, offset=None)

Retrieve a list of deployments associated with this registered model version.

Parameters:
searchOptional[str]
sort_keyOptional[RegisteredModelDeploymentSortKey]
sort_directionOptional[RegisteredModelSortDirection]
limitOptional[int]
offsetOptional[int]
Returns:
deploymentsList[VersionAssociatedDeployment]

A list of deployments associated with this registered model version.

Return type:

List[VersionAssociatedDeployment]

class datarobot.models.model_registry.deployment.VersionAssociatedDeployment(id, currently_deployed, registered_model_version, is_challenger, status, label=None, first_deployed_at=None, first_deployed_by=None, created_by=None, prediction_environment=None)

Represents a deployment associated with a registered model version.

Parameters:
idstr

The ID of the deployment.

currently_deployedbool

Whether this version is currently deployed.

registered_model_versionint

The version of the registered model associated with this deployment.

is_challengerbool

Whether the version associated with this deployment is a challenger.

statusstr

The status of the deployment.

labelstr, optional

The label of the deployment.

first_deployed_atdatetime.datetime, optional

The time the version was first deployed.

first_deployed_byUserMetadata, optional

The user who first deployed the version.

created_byUserMetadata, optional

The user who created the deployment.

prediction_environmentDeploymentPredictionEnvironment, optional

The prediction environment of the deployment.

class datarobot.models.model_registry.RegisteredModelVersionsListFilters(target_name=None, target_type=None, compatible_with_leaderboard_model_id=None, compatible_with_model_package_id=None, for_challenger=None, prediction_threshold=None, imported=None, prediction_environment_id=None, model_kind=None, build_status=None, use_case_id=None, tags=None)

Filters for listing of registered model versions.

Parameters:
target_name: str or None

Name of the target to filter by.

target_type: str or None

Type of the target to filter by.

compatible_with_leaderboard_model_id: str or None.

If specified, limit results to versions (model packages) of the Leaderboard model with the specified ID.

compatible_with_model_package_id: str or None.

Returns versions compatible with the given model package (version) ID. If used, it will only return versions that match target.name, target.type, target.classNames (for classification models), modelKind.isTimeSeries and modelKind.isMultiseries for the specified model package (version).

for_challenger: bool or None

Can be used with compatibleWithModelPackageId to request similar versions that can be used as challenger models; for external model packages (versions), instead of returning similar external model packages (versions), similar DataRobot and Custom model packages (versions) will be retrieved.

prediction_threshold: float or None

Return versions with the specified prediction threshold used for binary classification models.

imported: bool or None

If specified, return either imported (true) or non-imported (false) versions (model packages).

prediction_environment_id: str or None

Can be used to filter versions (model packages) by what is supported by the prediction environment

model_kind: str or None

Can be used to filter versions (model packages) by model kind.

build_status: str or None

If specified, filter versions by the build status.

class datarobot.models.model_registry.RegisteredModelListFilters(created_at_start=None, created_at_end=None, modified_at_start=None, modified_at_end=None, target_name=None, target_type=None, created_by=None, compatible_with_leaderboard_model_id=None, compatible_with_model_package_id=None, for_challenger=None, prediction_threshold=None, imported=None, prediction_environment_id=None, model_kind=None, build_status=None)

Filters for listing registered models.

Parameters:
created_at_startdatetime.datetime

Registered models created on or after this timestamp.

created_at_enddatetime.datetime

Registered models created before this timestamp. Defaults to the current time.

modified_at_startdatetime.datetime

Registered models modified on or after this timestamp.

modified_at_enddatetime.datetime

Registered models modified before this timestamp. Defaults to the current time.

target_namestr

Name of the target to filter by.

target_typestr

Type of the target to filter by.

created_bystr

Email of the user that created registered model to filter by.

compatible_with_leaderboard_model_idstr

If specified, limit results to registered models containing versions (model packages) for the leaderboard model with the specified ID.

compatible_with_model_package_idstr

Return registered models that have versions (model packages) compatible with given model package (version) ID. If used, will only return registered models which have versions that match target.name, target.type, target.classNames (for classification models), modelKind.isTimeSeries, and modelKind.isMultiseries of the specified model package (version).

for_challengerbool

Can be used with compatibleWithModelPackageId to request similar registered models that contain versions (model packages) that can be used as challenger models; for external model packages (versions), instead of returning similar external model packages (versions), similar DataRobot and Custom model packages will be retrieved.

prediction_thresholdfloat

If specified, return any registered models containing one or more versions matching the prediction threshold used for binary classification models.

importedbool

If specified, return any registered models that contain either imported (true) or non-imported (false) versions (model packages).

prediction_environment_idstr

Can be used to filter registered models by what is supported by the prediction environment.

model_kindstr

Return models that contain versions matching a specific format.

build_statusstr

If specified, only return models that have versions with specified build status.