Skip to content

Commit 8ab948b

Browse files
authored
MoMo API review changes (#34480) (#34509)
* review changes (#34480) * address comment
1 parent fa490a6 commit 8ab948b

File tree

2 files changed

+10
-29
lines changed

2 files changed

+10
-29
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_monitoring/compute.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
self.instance_type = instance_type
2727

2828
def _to_rest_object(self) -> MonitorServerlessSparkCompute:
29-
self.validate()
29+
self._validate()
3030
return MonitorServerlessSparkCompute(
3131
runtime_version=self.runtime_version,
3232
instance_type=self.instance_type,
@@ -42,7 +42,7 @@ def _from_rest_object(cls, obj: MonitorServerlessSparkCompute) -> "ServerlessSpa
4242
instance_type=obj.instance_type,
4343
)
4444

45-
def validate(self) -> None:
45+
def _validate(self) -> None:
4646
if self.runtime_version != "3.3":
4747
msg = "Compute runtime version must be 3.3"
4848
err = ValidationException(

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_monitoring/thresholds.py

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,6 @@ def _get_default_thresholds(cls) -> "NumericalDriftMetrics":
104104
normalized_wasserstein_distance=0.1,
105105
)
106106

107-
@classmethod
108-
def defaults(cls) -> "NumericalDriftMetrics":
109-
return cls._get_default_thresholds()
110-
111-
def get_name_and_threshold(self) -> Tuple:
112-
return self._find_name_and_threshold()
113-
114107

115108
class CategoricalDriftMetrics(RestTranslatableMixin):
116109
"""Categorical Drift Metrics
@@ -169,10 +162,6 @@ def _get_default_thresholds(cls) -> "CategoricalDriftMetrics":
169162
jensen_shannon_distance=0.1,
170163
)
171164

172-
@classmethod
173-
def defaults(cls) -> "CategoricalDriftMetrics":
174-
return cls._get_default_thresholds()
175-
176165
def get_name_and_threshold(self) -> Tuple:
177166
return self._find_name_and_threshold()
178167

@@ -204,15 +193,15 @@ def __init__(
204193
def _to_rest_object(self) -> DataDriftMetricThresholdBase:
205194
thresholds = []
206195
if self.numerical:
207-
num_metric_name, num_threshold = self.numerical.get_name_and_threshold()
196+
num_metric_name, num_threshold = self.numerical._find_name_and_threshold()
208197
thresholds.append(
209198
NumericalDataDriftMetricThreshold(
210199
metric=snake_to_camel(num_metric_name),
211200
threshold=num_threshold,
212201
)
213202
)
214203
if self.categorical:
215-
cat_metric_name, cat_threshold = self.categorical.get_name_and_threshold()
204+
cat_metric_name, cat_threshold = self.categorical._find_name_and_threshold()
216205
thresholds.append(
217206
CategoricalDataDriftMetricThreshold(
218207
metric=snake_to_camel(cat_metric_name),
@@ -244,8 +233,8 @@ def _from_rest_object(cls, obj: DataDriftMetricThresholdBase) -> "DataDriftMetri
244233
@classmethod
245234
def _get_default_thresholds(cls) -> "DataDriftMetricThreshold":
246235
return cls(
247-
numerical=NumericalDriftMetrics.defaults(),
248-
categorical=CategoricalDriftMetrics.defaults(),
236+
numerical=NumericalDriftMetrics._get_default_thresholds(),
237+
categorical=CategoricalDriftMetrics._get_default_thresholds(),
249238
)
250239

251240
def __eq__(self, other: Any) -> bool:
@@ -279,15 +268,15 @@ def __init__(
279268
def _to_rest_object(self) -> PredictionDriftMetricThresholdBase:
280269
thresholds = []
281270
if self.numerical:
282-
num_metric_name, num_threshold = self.numerical.get_name_and_threshold()
271+
num_metric_name, num_threshold = self.numerical._find_name_and_threshold()
283272
thresholds.append(
284273
NumericalPredictionDriftMetricThreshold(
285274
metric=snake_to_camel(num_metric_name),
286275
threshold=num_threshold,
287276
)
288277
)
289278
if self.categorical:
290-
cat_metric_name, cat_threshold = self.categorical.get_name_and_threshold()
279+
cat_metric_name, cat_threshold = self.categorical._find_name_and_threshold()
291280
thresholds.append(
292281
CategoricalPredictionDriftMetricThreshold(
293282
metric=snake_to_camel(cat_metric_name),
@@ -319,8 +308,8 @@ def _from_rest_object(cls, obj: PredictionDriftMetricThresholdBase) -> "Predicti
319308
@classmethod
320309
def _get_default_thresholds(cls) -> "PredictionDriftMetricThreshold":
321310
return cls(
322-
numerical=NumericalDriftMetrics.defaults(),
323-
categorical=CategoricalDriftMetrics.defaults(),
311+
numerical=NumericalDriftMetrics._get_default_thresholds(),
312+
categorical=CategoricalDriftMetrics._get_default_thresholds(),
324313
)
325314

326315
def __eq__(self, other: Any) -> bool:
@@ -404,10 +393,6 @@ def _get_default_thresholds(cls) -> "DataQualityMetricsNumerical":
404393
out_of_bounds_rate=0.0,
405394
)
406395

407-
@classmethod
408-
def defaults(cls) -> "DataQualityMetricsNumerical":
409-
return cls._get_default_thresholds()
410-
411396

412397
class DataQualityMetricsCategorical(RestTranslatableMixin):
413398
"""Data Quality Categorical Metrics
@@ -480,10 +465,6 @@ def _get_default_thresholds(cls) -> "DataQualityMetricsCategorical":
480465
out_of_bounds_rate=0.0,
481466
)
482467

483-
@classmethod
484-
def defaults(cls) -> "DataQualityMetricsCategorical":
485-
return cls._get_default_thresholds()
486-
487468

488469
class DataQualityMetricThreshold(MetricThreshold):
489470
"""Data quality metric threshold

0 commit comments

Comments
 (0)