Categories:

Model monitor functions

MODEL_MONITOR_DRIFT_METRIC

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

See also:

Querying monitoring results for more information.

Syntax

MODEL_MONITOR_DRIFT_METRIC(
  <model_monitor_name>, <drift_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.

drift_metric_name

Name of the metric.

Valid values:

  • 'JENSEN_SHANNON'

  • 'DIFFERENCE_OF_MEANS'

  • 'WASSERSTEIN'

column_name

Name of the column used to compute drift.

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

Example values

EVENT_TIMESTAMP

Timestamp at the start of the time range.

2024-01-01 00:00:00.000

METRIC_VALUE

Value of the metric within the specified time range.

5

COL_COUNT_USED

Number of records used to compute the metric.

100

COL_COUNT_UNUSED

Number of records excluded from the metric computation.

10

BASELINE_COL_COUNT_USED

Number of records used to compute the metric.

10

BASELINE_COL_COUNT_UNUSED

Number of records excluded from the metric computation.

0

METRIC_NAME

Name of the drift metric that has been computed.

DIFFERENCE_OF_MEANS

COLUMN_NAME

Name of the column for which the drift metric has been computed.

FEATURE_NAME

Usage Notes

The model monitor must have a baseline set for the drift metric to be computed.

You might run into errors if you:

  • Don’t set a baseline for the model monitor.

  • Requested a numerical drift metric for a non-numeric feature.

  • Use a drift metric that doesn’t exist in the model monitor.

Examples

The following example gets the differences of means drift metric for MY_MONITOR over a one-day period:

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