19
19
20
20
from google .cloud .aiplatform .compat .types import (
21
21
explanation_v1beta1 as explanation ,
22
+ machine_resources_v1beta1 as machine_resources ,
22
23
model_monitoring_alert_v1beta1 as model_monitoring_alert ,
23
24
model_monitoring_spec_v1beta1 as model_monitoring_spec ,
24
25
)
@@ -156,6 +157,11 @@ class FeatureAttributionSpec:
156
157
features=["feature1"]
157
158
default_alert_threshold=0.01,
158
159
feature_alert_thresholds={"feature1":0.02, "feature2":0.01},
160
+ batch_dedicated_resources=BatchDedicatedResources(
161
+ starting_replica_count=1,
162
+ max_replica_count=2,
163
+ machine_spec=my_machine_spec,
164
+ ),
159
165
)
160
166
161
167
Attributes:
@@ -170,17 +176,23 @@ class FeatureAttributionSpec:
170
176
feature_alert_thresholds (Dict[str, float]):
171
177
Optional. Per feature alert threshold will override default alert
172
178
threshold.
179
+ batch_dedicated_resources (machine_resources.BatchDedicatedResources):
180
+ Optional. The config of resources used by the Model Monitoring during
181
+ the batch explanation for non-AutoML models. If not set, `n1-standard-2`
182
+ machine type will be used by default.
173
183
"""
174
184
175
185
def __init__ (
176
186
self ,
177
187
features : Optional [List [str ]] = None ,
178
188
default_alert_threshold : Optional [float ] = None ,
179
189
feature_alert_thresholds : Optional [Dict [str , float ]] = None ,
190
+ batch_dedicated_resources : Optional [machine_resources .BatchDedicatedResources ] = None ,
180
191
):
181
192
self .features = features
182
193
self .default_alert_threshold = default_alert_threshold
183
194
self .feature_alert_thresholds = feature_alert_thresholds
195
+ self .batch_dedicated_resources = batch_dedicated_resources
184
196
185
197
def _as_proto (
186
198
self ,
@@ -216,6 +228,7 @@ def _as_proto(
216
228
default_alert_condition = user_default_alert_threshold ,
217
229
feature_alert_conditions = user_alert_thresholds ,
218
230
features = user_features ,
231
+ batch_explanation_dedicated_resources = self .batch_dedicated_resources ,
219
232
)
220
233
)
221
234
0 commit comments