- Categories:
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> ] ] ]
)
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. Default value is
1 DAY
.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. The default value is 60 days before the current time, and is calculated each time you call the function.
Valid values: A timestamp expression or
NULL
.end_time
End of the time range used to compute the metric. The default value is the current time, and is calculated each time you call the function.
Valid values: A timestamp expression or
NULL
.
Returns¶
Column |
Description |
Example values |
---|---|---|
|
Timestamp at the start of the time range. |
|
|
Value of the metric within the specified time range. |
|
|
Number of records used to compute the metric. |
|
|
Number of records excluded from the metric computation. |
|
|
Number of records used to compute the metric. |
|
|
Number of records excluded from the metric computation. |
|
|
Name of the drift metric that has been computed. |
|
|
Name of the column for which the drift metric has been computed. |
|
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'))
)
The following example gets the Jensen-Shannon drift metric for MY_MONITOR
over the last 30 days:
SELECT * FROM TABLE(MODEL_MONITOR_DRIFT_METRIC(
'MY_MONITOR', 'JENSEN_SHANNON', 'MODEL_PREDICTION', '1 DAY', DATEADD('DAY', -30, CURRENT_DATE()), CURRENT_DATE())
)