Skip to content

Commit 6150322

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
chore: Add batch_dedicated_resources parameter for feature attribution spec in Model Monitoring SDK.
PiperOrigin-RevId: 631957771
1 parent 378c68a commit 6150322

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

vertexai/resources/preview/ml_monitoring/spec/objective.py

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from google.cloud.aiplatform.compat.types import (
2121
explanation_v1beta1 as explanation,
22+
machine_resources_v1beta1 as machine_resources,
2223
model_monitoring_alert_v1beta1 as model_monitoring_alert,
2324
model_monitoring_spec_v1beta1 as model_monitoring_spec,
2425
)
@@ -156,6 +157,11 @@ class FeatureAttributionSpec:
156157
features=["feature1"]
157158
default_alert_threshold=0.01,
158159
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+
),
159165
)
160166
161167
Attributes:
@@ -170,17 +176,23 @@ class FeatureAttributionSpec:
170176
feature_alert_thresholds (Dict[str, float]):
171177
Optional. Per feature alert threshold will override default alert
172178
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.
173183
"""
174184

175185
def __init__(
176186
self,
177187
features: Optional[List[str]] = None,
178188
default_alert_threshold: Optional[float] = None,
179189
feature_alert_thresholds: Optional[Dict[str, float]] = None,
190+
batch_dedicated_resources: Optional[machine_resources.BatchDedicatedResources] = None,
180191
):
181192
self.features = features
182193
self.default_alert_threshold = default_alert_threshold
183194
self.feature_alert_thresholds = feature_alert_thresholds
195+
self.batch_dedicated_resources = batch_dedicated_resources
184196

185197
def _as_proto(
186198
self,
@@ -216,6 +228,7 @@ def _as_proto(
216228
default_alert_condition=user_default_alert_threshold,
217229
feature_alert_conditions=user_alert_thresholds,
218230
features=user_features,
231+
batch_explanation_dedicated_resources=self.batch_dedicated_resources,
219232
)
220233
)
221234

0 commit comments

Comments
 (0)