Skip to main content

Custom Metric Syntax Overview

Custom metrics use an Arize SQL-like query language.
SELECT
< AGG_FUNC | METRIC_FUNC >(exprs) 
[FILTER (WHERE exprs)]  
[CASE WHEN ...END ]
[ <OPERATOR> { < AGG_FUNC | ARIZE_METRIC >(exprs) | constant }]  … 
FROM model
[WHERE (exprs) ]

SELECT

Every query starts with a SELECT statement.

FROM

The FROM statement should beFROM model, where model refers to the model that the custom metric was created under.

Constants

A constant can be a number or string. Strings use single quotes like this: 'this is a string'. Numbers can be floats or integers.

Expressions

dimension
constant
[ dimension | constant | (exprs) ] <OPERATOR> [ dimension | constant | (exprs) ]
An expression is a statement composed of simple math or boolean operators. An expression does not have an aggregation function within it. Expressions can include nested expressions, for example, A * (B + C). Expressions return the same number of rows as those that go into it.

Dimensions

A dimension is any feature, tag, prediction, actual, or span property of a model. A dimension can either be of type string or of type numeric.
TypeInvocationDescription
Featurefeature_name or "feature name"Features can be referenced directly or use double quotes.Note: if there are spaces in your feature name, you must use double quotes.
Tagtag_name or "tag name"Tags can be referenced directly or use double quotes.Note: if there are spaces in your tag name, you must use double quotes.
PredictioncategoricalPredictionLabel scorePredictionLabel numericPredictionLabelFor scored categorical models, there is categoricalPredictionLabel and scorePredictionLabel For numeric models, there is only numericPredictionLabel
ActualcategoricalActualLabel scoreActualLabel numericActualLabelFor scored categorical models, there is categoricalActualLabel and scoreActualLabelFor numeric models, there is only numericActualLabel
Span Propertyspan_property or "span property" or "span. property"Span properties can be referenced directly or use double quotes.Note: if there are spaces or periods in your span property name, you must use double quotes.

Comments

Comments can be added to your query in one of two ways: Single line comment (shortcut is CMD + /)
-- This is a single line comment
Multi-line comments
/* This
 * is a 
 * multiline comment
 */