@@ -234,11 +234,14 @@ from azure.ai.ml.constants import (
234
234
)
235
235
from azure.ai.ml.entities import (
236
236
AlertNotification,
237
+ BaselineDataRange,
237
238
DataDriftSignal,
238
239
DataQualitySignal,
239
240
PredictionDriftSignal,
240
241
DataDriftMetricThreshold,
241
242
DataQualityMetricThreshold,
243
+ FeatureAttributionDriftMetricThreshold,
244
+ FeatureAttributionDriftSignal,
242
245
PredictionDriftMetricThreshold,
243
246
NumericalDriftMetrics,
244
247
CategoricalDriftMetrics,
@@ -251,7 +254,8 @@ from azure.ai.ml.entities import (
251
254
RecurrencePattern,
252
255
RecurrenceTrigger,
253
256
ServerlessSparkCompute,
254
- ReferenceData
257
+ ReferenceData,
258
+ ProductionData
255
259
)
256
260
257
261
# get a handle to the workspace
@@ -274,13 +278,27 @@ monitoring_target = MonitoringTarget(
274
278
endpoint_deployment_id = " azureml:credit-default:main"
275
279
)
276
280
281
+ # specify a lookback window size and offset, or omit this to use the defaults, which are specified in the documentation
282
+ data_window = BaselineDataRange(lookback_window_size = " P1D" , lookback_window_offset = " P0D" )
283
+
284
+ production_data = ProductionData(
285
+ input_data = Input(
286
+ type = " uri_folder" ,
287
+ path = " azureml:credit-default-main-model_inputs:1"
288
+ ),
289
+ data_window = data_window,
290
+ data_context = MonitorDatasetContext.MODEL_INPUTS ,
291
+ )
292
+
277
293
# training data to be used as reference dataset
278
294
reference_data_training = ReferenceData(
279
295
input_data = Input(
280
296
type = " mltable" ,
281
297
path = " azureml:credit-default-reference:1"
282
298
),
283
- target_column_name = " DEFAULT_NEXT_MONTH" ,
299
+ data_column_names = {
300
+ " target_column" :" DEFAULT_NEXT_MONTH"
301
+ },
284
302
data_context = MonitorDatasetContext.TRAINING ,
285
303
)
286
304
@@ -333,10 +351,20 @@ advanced_data_quality = DataQualitySignal(
333
351
alert_enabled = False
334
352
)
335
353
354
+ # create feature attribution drift signal
355
+ metric_thresholds = FeatureAttributionDriftMetricThreshold(normalized_discounted_cumulative_gain = 0.9 )
356
+
357
+ feature_attribution_drift = FeatureAttributionDriftSignal(
358
+ reference_data = reference_data_training,
359
+ metric_thresholds = metric_thresholds,
360
+ alert_enabled = False
361
+ )
362
+
336
363
# put all monitoring signals in a dictionary
337
364
monitoring_signals = {
338
365
' data_drift_advanced' :advanced_data_drift,
339
- ' data_quality_advanced' :advanced_data_quality
366
+ ' data_quality_advanced' :advanced_data_quality,
367
+ ' feature_attribution_drift' :feature_attribution_drift,
340
368
}
341
369
342
370
# create alert notification object
@@ -564,9 +592,9 @@ from azure.ai.ml.entities import (
564
592
# get a handle to the workspace
565
593
ml_client = MLClient(
566
594
DefaultAzureCredential(),
567
- subscription_id="79a1ba0c-35bb-436b-bff2-3074d5ff1f89 ",
568
- resource_group_name="rg-bozhlinmomoignite ",
569
- workspace_name="momo-demo-ws ",
595
+ subscription_id="subscription_id ",
596
+ resource_group_name="resource_group_name ",
597
+ workspace_name="workspace_name ",
570
598
)
571
599
572
600
# create your compute
0 commit comments