Skip to content

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 (str or None) – ID of the user who created the metric.
    • organization_id (str or None) – ID of the owning organization.
    • description (str or None) – 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 (str or None) – ISO-8601 creation timestamp.
    • updated_at (str or None) – ISO-8601 last-updated timestamp.
    • tags (list of dict) – Tag entries, each {"name": str, "value": str} (additional keys allowed).

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 and isArchived is omitted from the list request.
    • tags (list of dict, optional) – Tag entries shaped as {"name": ..., "value": ...}.
  • 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 (list of dict, optional) – Tag entries shaped as {"name": ..., "value": ...}.
  • 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 (list of dict, optional) – Replacement tags, each {"name": ..., "value": ...}.
  • 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 (int or None) – Sequential version number assigned on creation.
    • files_catalog_id (str or None) – ID of the files catalog entry storing the uploaded files.
    • files_catalog_version_id (str or None) – ID of the specific catalog version.
    • metrics (list) – Metric definitions parsed from the uploaded metadata.
    • stage (str or None) – Lifecycle stage of this version.
    • description (str or None) – Optional description provided at upload time.
    • validation_status (str or None) – Status of server-side validation of the uploaded files.
    • user_id (str or None) – ID of the user who created this version.

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.
  • 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 the metadata.yml file.
    • code_file_path (str) – Local path to the custom_metrics.py file.
    • description (str, optional) – Optional description for this version.
  • 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.
  • 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.
  • Return type: CustomScoringMetricVersionFileContents

get_files()

Retrieve the raw metadata and code file contents for this version.

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.yml or metadata.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.