Skip to content

custom_metric

CustomMetric

Class for interacting with custom metrics in NannyML Cloud.

create classmethod

create(name: str, description: str, problem_type: Literal['REGRESSION'], *, loss_function: TCustomMetricSource, aggregation_function: TCustomMetricSource, lower_value_limit: Optional[float] = None, upper_value_limit: Optional[float] = None) -> CustomRegressionMetricDetails
create(name: str, description: str, problem_type: Literal['BINARY_CLASSIFICATION', 'MULTICLASS_CLASSIFICATION'], *, calculation_function: TCustomMetricSource, estimation_function: Optional[TCustomMetricSource] = None, lower_value_limit: Optional[float] = None, upper_value_limit: Optional[float] = None) -> CustomClassificationMetricDetails
create(name: str, description: str, problem_type: ProblemType, calculation_function: Optional[TCustomMetricSource] = None, estimation_function: Optional[TCustomMetricSource] = None, loss_function: Optional[TCustomMetricSource] = None, aggregation_function: Optional[TCustomMetricSource] = None, lower_value_limit: Optional[float] = None, upper_value_limit: Optional[float] = None) -> TCustomMetricDetails

Create a new custom metric.

delete classmethod

delete(metric_id: str) -> TCustomMetricDetails

Delete a custom metric.

get classmethod

get(metric_id: int) -> TCustomMetricDetails

Get details of a custom metric.

Parameters:

Name Type Description Default
metric_id int

Unique identifier of the custom metric.

required

Returns:

Type Description
TCustomMetricDetails

Details of the custom metric.

list classmethod

list(name: Optional[str] = None, problem_type: Optional[ProblemType] = None) -> List[CustomMetricSummary]

List defined custom metrics.

Parameters:

Name Type Description Default
name Optional[str]

Optional name filter.

None
problem_type Optional[ProblemType]

Optional problem type filter.

None

Returns:

Type Description
List[CustomMetricSummary]

List of custom metrics that match the provided filter criteria.

CustomMetricDetails

Bases: TypedDict

Details of a custom metric.

Attributes:

Name Type Description
description str

User-defined description of the custom metric

CustomMetricSummary

Bases: TypedDict

Summary of a custom metric.

Attributes:

Name Type Description
id int

Unique identifier of the custom metric (generated by NannyML Cloud when a custom metric is created).

name str

User-defined name of the custom metric.

problemType ProblemType

Type of problem the custom metric can be applied to.

createdAt datetime

Timestamp when the model was created.