Categories:

Model monitor functions

MODEL_MONITOR_STAT_METRIC

Gets count metrics from a model monitor. Each model monitor monitors one machine learning model.

See also:

Querying monitoring results for more information.

Syntax

MODEL_MONITOR_STAT_METRIC(<model_monitor_name>, <stat_metric_name>, <column_name>
    [, <granularity> [, <start_time>  [, <end_time> ] ] ] )
Copy

Arguments

Required:

MODEL_MONITOR_NAME

Name of the model monitor used to compute the metric.

Valid values:

A string that’s the name of the model monitor. It can be a simple or fully qualified name.

METRIC_NAME

Name of the metric.

Valid values:

  • 'COUNT'

  • 'COUNT_NULL'

COLUMN_NAME

Name of the column used to compute the count.

Valid values:

Any string that exists as a feature column, prediction column, or actual column in the model monitor.

Optional:

GRANULARITY

Granularity of the time range being queried.

Valid values:

  • '<num> DAY'

  • '<num> WEEK'

  • '<num> MONTH'

  • '<num> QUARTER'

  • '<num> YEAR'

  • 'ALL'

  • NULL

START_TIME

Start of the time range used to compute the metric.

Valid values:

A constant timestream expression or NULL.

END_TIME

End of the time range used to compute the metric.

Valid values:

A constant timestream expression or NULL.

Returns

Column

Description

EVENT_TIMESTAMP

Timestamp at the start of the time range.

METRIC_VALUE

Value of the metric within the specified time range.

COUNT_USED

Number of records used to compute the metric.

COUNT_UNUSED

Number of records excluded from the metric computation.

METRIC_NAME

Name of the metric that has been computed.

Usage Notes

The model monitor must have the column being used to calculate the metric.

Examples

The following example gets count metrics for the specified model monitor and time range:

SELECT * FROM TABLE(MODEL_MONITOR_STAT_METRIC(
'MY_MONITOR', 'COUNT', 'MODEL_PREDICTION', '1 DAY', TO_TIMESTAMP_TZ('2024-01-01')
, TO_TIMESTAMP_TZ('2024-01-02'))
)
Copy