Method
createCustomMetric POST
Copy POST

Registers a new custom metric which can be used as an evaluation metric for the trained model.

Arguments:

REQUIRED KEY TYPE DESCRIPTION
Yes name str A unique name for the metric, with a limit of 50 characters. Only underscores, numbers, and uppercase alphabets are allowed.
Yes problemType str The problem type that this metric would be applicable to, e.g. REGRESSION, FORECASTING, etc.
No customMetricFunctionName str The name of the function whose full source code is passed in source_code.
No sourceCode str The full source code of the custom metric function. This is required if custom_metric_function_name is passed.
Note: The arguments for the API methods follow camelCase but for Python SDK underscore_case is followed.

Response:

KEY TYPE DESCRIPTION
success Boolean true if the call succeeded, false if there was an error
result CustomMetric
KEY TYPE Description
customMetricId str Unique string identifier of the custom metric.
name str Name assigned to the custom metric.
createdAt str Date and time when the custom metric was created (ISO 8601 format).
problemType str Problem type that this custom metric is applicable to (e.g. regression).
notebookId str Unique string identifier of the notebook used to create/edit the custom metric.
latestCustomMetricVersion CustomMetricVersion Latest version of the custom metric.
KEY TYPE Description
customMetricVersion str Unique string identifier for the custom metric version.
name str Name assigned to the custom metric.
createdAt str ISO-8601 string indicating when the custom metric was created.
customMetricFunctionName str The name of the function defined in the source code.
codeSource CodeSource Information about the source code of the custom metric.
KEY TYPE Description
sourceType str The type of the source, one of TEXT, PYTHON, FILE_UPLOAD, or APPLICATION_CONNECTOR
sourceCode str If the type of the source is TEXT, the raw text of the function
applicationConnectorId str The Application Connector to fetch the code from
applicationConnectorInfo str Args passed to the application connector to fetch the code
packageRequirements list The pip package dependencies required to run the code
status str The status of the code and validations
error str If the status is failed, an error message describing what went wrong
publishingMsg dict Warnings in the source code
moduleDependencies list The list of internal modules dependencies required to run the code

Exceptions:

TYPE WHEN
InvalidEnumParameterError

An invalid value is passed for problemType.

InvalidParameterError

If either the custom metric name or type or the passed function is invalid/incompatible.

AlreadyExistsError

If a custom metric with the given name already exists in the organization.

Language: