Model Registry
Registered models are generic containers that group multiple versions of models which can be deployed, used as a challenger model, or replace a deployed model. Each registered model can have multiple versions. Each version can be created from a DataRobot model, custom model, or external model. Registered models can have versions of different types (leaderboard, custom, or external) simultaneously as long as they have same target properties and time series settings where applicable.
Create registered model & version
The following command can be used to either create a registered model from or add version to the existing model.
LEADERBOARD_MODEL_ID = "650c2372c538ffa4480567d1"
first_version = dr.RegisteredModelVersion.create_for_leaderboard_item(
model_id=LEADERBOARD_MODEL_ID,
name="Name of the version(aka model package)",
registered_model_name='DEMO 3: Name of the registered model unique across the org '
)
# add custom model as a version
CUSTOM_MODEL_VERSION_ID = "619679c86c1abbc2bd628ed1"
second_version_from_custom = dr.RegisteredModelVersion.create_for_custom_model_version(
custom_model_version_id=first_version.registered_model_id,
name="Another Name of the version(aka model package)",
)
# add external model as a version
second_version_from_external = dr.RegisteredModelVersion.create_for_external(
name='Another name',
target={'name': 'Target', 'type': 'Regression'},
registered_model_id=first_version.registered_model_id,
)
List and filter registered models
Use the following command to list registered models.
You can filter the registered models that are returned by passing an instance of the
RegisteredModelListFilters
class to the filters
keyword argument.
You can also filter the registered model versions that are returned by passing an instance of the
RegisteredModelVersionsListFilters
class to the filters
keyword argument.
demo_registered_models = dr.RegisteredModel.list(search="DEMO")
registered_model_filters = dr.models.model_registry.RegisteredModelListFilters(
created_at_start=datetime.datetime(2020, 1, 1),
created_at_end=datetime.datetime(2024, 1, 2),
modified_at_start=datetime.datetime(2020, 1, 1),
modified_at_end=datetime.datetime(2024, 1, 2),
target_name='readmitted',
target_type='Binary',
created_by='[email protected]',
compatible_with_model_package_id='650a9f57d3f427ce1cc64747',
prediction_threshold=0.5,
imported=False,
for_challenger=False,
)
registered_models = dr.RegisteredModel.list(filters=registered_model_filters, search="10k")
registered_model = registered_models[0]
versions = registered_model.list_versions()
# similarily to registered models, versions also support fine-grain filtering and search
filters = dr.models.model_registry.RegisteredModelVersionsListFilters(
target_name='readmitted',
)
versions_with_search = registered_model.list_versions(search="Elastic", filters=filters)
List deployments associated with a registered model
Use the following command to list deployments associated with registered model. The deployment is considered associated if one of the versions of the registered model is either a champion or a challenger model.
model_with_deployments = dr.RegisteredModel.get('65035d911e9ff5b07f00f2ea')
# we can list deployments associated with this registered model. Method is searchable and paginated.
model_associated_deployments = model_with_deployments.list_associated_deployments()
# we can also list deployments associated with specific version of the registered model
version = model_with_deployments.list_versions()[1]
version.list_associated_deployments()