client.add_custom_metric

Adds a user-defined Custom Metric to a model.

For details on supported constants, operators, and functions, see Fiddler Query Language.

Input ParameterTypeRequiredDescription
namestringYesName of the custom metric
project_idstringYesThe unique identifier for the project
model_idstringYesThe unique identifier for the model
definitionstringYesThe FQL metric definition for the custom metric
descriptionstringNoA description of the custom metric
PROJECT_ID = 'my_project'
MODEL_ID = 'my_model'

definition = """
    average(if(Prediction < 0.5 and Target == 1, -40, if(Prediction >= 0.5 and Target == 0, -400, 250)))
"""

client.add_custom_metric(
    name='Loan Value',
    description='A custom value score assigned to a loan',
    project_id=PROJECT_ID,
    model_id=MODEL_ID,
    definition=definition
)