Custom Metric Syntax

Breakdown of the Arize Query Language

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

Feature

feature_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.

Tag

tag_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.

Prediction

categoricalPredictionLabel scorePredictionLabel numericPredictionLabel

For scored categorical models, there is categoricalPredictionLabel and scorePredictionLabel For numeric models, there is only numericPredictionLabel

Actual

categoricalActualLabel scoreActualLabel numericActualLabel

For scored categorical models, there is categoricalActualLabel and scoreActualLabel

For numeric models, there is only numericActualLabel

Span Property

span_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
 */

Last updated

Copyright © 2023 Arize AI, Inc