Custom scoring metrics¶
class datarobot.models.custom_scoring_metrics.CustomScoringMetric¶
A versioned custom scoring metric container.
- Variables:
- id (
str) – Unique identifier. - name (
str) – Display name of the metric. - target_type (
str) – The target type this metric applies to (e.g. Binary, Regression, Multiclass). - user_id (
strorNone) – ID of the user who created the metric. - organization_id (
strorNone) – ID of the owning organization. - description (
strorNone) – Optional description. - latest_version_num (
int) – The highest version number that has been created. - is_archived (
bool) – Whether the metric has been soft-deleted. - created_at (
strorNone) – ISO-8601 creation timestamp. - updated_at (
strorNone) – ISO-8601 last-updated timestamp. - tags (
listofdict) – Tag entries, each{"name": str, "value": str}(additional keys allowed).
- id (
classmethod list(offset=0, limit=20, target_type=None, search=None, is_archived=False, tags=None)¶
List custom scoring metrics.
- Parameters:
- offset (
int) – Number of records to skip. - limit (
int) – Maximum number of records to return. - target_type (
str, optional) – Filter by target type (e.g. “Binary”, “Regression”, “Multiclass”). - search (
str, optional) – Filter by name sub-string. - is_archived (
bool) – When True, return only archived metrics. When False (default), non-archived metrics are returned andisArchivedis omitted from the list request. - tags (
listofdict, optional) – Tag entries shaped as{"name": ..., "value": ...}.
- offset (
- Return type:
list[CustomScoringMetric]
classmethod create(name, target_type, description=None, tags=None)¶
Create a new custom scoring metric container.
- Parameters:
- name (
str) – Display name for the metric. - target_type (
str) – Target type this metric applies to. - description (
str, optional) – Optional description. - tags (
listofdict, optional) – Tag entries shaped as{"name": ..., "value": ...}.
- name (
- Return type:
CustomScoringMetric
classmethod get(metric_id)¶
Retrieve a custom scoring metric by ID.
- Parameters:
metric_id (
str) – The ID of the metric to retrieve. - Return type:
CustomScoringMetric
update(name=None, description=None, tags=None)¶
Update the name, description, or tags of this metric.
- Parameters:
- name (
str, optional) – New display name. - description (
str, optional) – New description. - tags (
listofdict, optional) – Replacement tags, each{"name": ..., "value": ...}.
- name (
- Returns: This instance, updated in place.
- Return type:
CustomScoringMetric
delete()¶
Archive (soft-delete) this metric.
- Return type:
None
class datarobot.models.custom_scoring_metrics.CustomScoringMetricVersion¶
A single version of a custom scoring metric.
Versions are created by uploading a metadata.yml and custom_metrics.py
file pair. Each new version receives the next sequential version number.
- Variables:
- id (
str) – Unique identifier of this version. - custom_scoring_metric_registry_id (
str) – ID of the parent metric container. - version_num (
intorNone) – Sequential version number assigned on creation. - files_catalog_id (
strorNone) – ID of the files catalog entry storing the uploaded files. - files_catalog_version_id (
strorNone) – ID of the specific catalog version. - metrics (
list) – Metric definitions parsed from the uploaded metadata. - stage (
strorNone) – Lifecycle stage of this version. - description (
strorNone) – Optional description provided at upload time. - validation_status (
strorNone) – Status of server-side validation of the uploaded files. - user_id (
strorNone) – ID of the user who created this version.
- id (
classmethod list(metric_id, offset=0, limit=20)¶
List all versions for a given custom scoring metric.
- Parameters:
- metric_id (
str) – ID of the parent metric container. - offset (
int) – Number of records to skip. - limit (
int) – Maximum number of records to return.
- metric_id (
- Return type:
list[CustomScoringMetricVersion]
classmethod create(metric_id, metadata_file_path, code_file_path, description=None)¶
Upload a new version of a custom scoring metric.
Sends metadata.yml and custom_metrics.py as multipart form data.
- Parameters:
- metric_id (
str) – ID of the parent metric container. - metadata_file_path (
str) – Local path to themetadata.ymlfile. - code_file_path (
str) – Local path to thecustom_metrics.pyfile. - description (
str, optional) – Optional description for this version.
- metric_id (
- Return type:
CustomScoringMetricVersion
classmethod get(metric_id, version_id)¶
Retrieve a specific version of a custom scoring metric.
- Parameters:
- metric_id (
str) – ID of the parent metric container. - version_id (
str) – ID of the version to retrieve.
- metric_id (
- Return type:
CustomScoringMetricVersion
delete()¶
Delete this version.
- Return type:
None
classmethod get_file_contents(registry_id, registry_version_id)¶
Retrieve the raw metadata and code file contents for a version.
- Parameters:
- registry_id (
str) – ID of the parent custom scoring metric registry. - registry_version_id (
str) – ID of the registry version whose files should be retrieved.
- registry_id (
- Return type:
CustomScoringMetricVersionFileContents
get_files()¶
Retrieve the raw metadata and code file contents for this version.
- Return type:
CustomScoringMetricVersionFileContents
class datarobot.models.custom_scoring_metrics.CustomScoringMetricVersionFileContents¶
Raw file contents (metadata + code) backing a custom scoring metric version.
- Variables:
- metadata_file_name (
str) – Stored name of the metadata file (e.g.metadata.ymlormetadata.yaml). - metadata_file_contents (
str) – Raw UTF-8 contents of the metadata file. - code_file_name (
str) – Stored name of the Python file (e.g.custom_metrics.py). - code_file_contents (
str) – Raw UTF-8 contents of the custom metrics Python file.
- metadata_file_name (