Skip to content

Commit a65f8c5

Browse files
author
Chuyang Deng
committed
change: deprecate unused parameters
1 parent 6b76093 commit a65f8c5

36 files changed

+5
-195
lines changed

doc/algorithms/randomcutforest.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Amazon SageMaker Random Cut Forest algorithm.
88
:undoc-members:
99
:show-inheritance:
1010
:inherited-members:
11-
:exclude-members: image_uri, num_trees, num_samples_per_tree, eval_metrics, feature_dim, MINI_BATCH_SIZE
11+
:exclude-members: image_uri, num_trees, num_samples_per_tree, feature_dim, MINI_BATCH_SIZE
1212

1313

1414
.. autoclass:: sagemaker.RandomCutForestModel

src/sagemaker/amazon/kmeans.py

-12
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ class KMeans(AmazonAlgorithmEstimatorBase):
4343
)
4444
epochs = hp("epochs", gt(0), "An integer greater-than 0", int)
4545
center_factor = hp("extra_center_factor", gt(0), "An integer greater-than 0", int)
46-
eval_metrics = hp(
47-
name="eval_metrics",
48-
validation_message='A comma separated list of "msd" or "ssd"',
49-
data_type=list,
50-
)
5146

5247
def __init__(
5348
self,
@@ -63,7 +58,6 @@ def __init__(
6358
half_life_time_size=None,
6459
epochs=None,
6560
center_factor=None,
66-
eval_metrics=None,
6761
**kwargs
6862
):
6963
"""A k-means clustering
@@ -130,11 +124,6 @@ def __init__(
130124
center_factor (int): The algorithm will create
131125
``num_clusters * extra_center_factor`` as it runs and reduce the
132126
number of centers to ``k`` when finalizing
133-
eval_metrics (list): JSON list of metrics types to be used for
134-
reporting the score for the model. Allowed values are "msd"
135-
Means Square Error, "ssd": Sum of square distance. If test data
136-
is provided, the score shall be reported in terms of all
137-
requested metrics.
138127
**kwargs: base class keyword argument values.
139128
140129
.. tip::
@@ -153,7 +142,6 @@ def __init__(
153142
self.half_life_time_size = half_life_time_size
154143
self.epochs = epochs
155144
self.center_factor = center_factor
156-
self.eval_metrics = eval_metrics
157145

158146
def create_model(self, vpc_config_override=VPC_CONFIG_DEFAULT, **kwargs):
159147
"""Return a :class:`~sagemaker.amazon.kmeans.KMeansModel` referencing

src/sagemaker/amazon/randomcutforest.py

-13
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ class RandomCutForest(AmazonAlgorithmEstimatorBase):
3131
repo_version = 1
3232
MINI_BATCH_SIZE = 1000
3333

34-
eval_metrics = hp(
35-
name="eval_metrics",
36-
validation_message='A comma separated list of "accuracy" or "precision_recall_fscore"',
37-
data_type=list,
38-
)
39-
4034
num_trees = hp("num_trees", (ge(50), le(1000)), "An integer in [50, 1000]", int)
4135
num_samples_per_tree = hp(
4236
"num_samples_per_tree", (ge(1), le(2048)), "An integer in [1, 2048]", int
@@ -50,7 +44,6 @@ def __init__(
5044
instance_type,
5145
num_samples_per_tree=None,
5246
num_trees=None,
53-
eval_metrics=None,
5447
**kwargs
5548
):
5649
"""RandomCutForest is :class:`Estimator` used for anomaly detection.
@@ -99,11 +92,6 @@ def __init__(
9992
build each tree in the forest. The total number of samples drawn
10093
from the train dataset is num_trees * num_samples_per_tree.
10194
num_trees (int): Optional. The number of trees used in the forest.
102-
eval_metrics (list): Optional. JSON list of metrics types to be used
103-
for reporting the score for the model. Allowed values are
104-
"accuracy", "precision_recall_fscore": positive and negative
105-
precision, recall, and f1 scores. If test data is provided, the
106-
score shall be reported in terms of all requested metrics.
10795
**kwargs: base class keyword argument values.
10896
10997
.. tip::
@@ -116,7 +104,6 @@ def __init__(
116104
super(RandomCutForest, self).__init__(role, instance_count, instance_type, **kwargs)
117105
self.num_samples_per_tree = num_samples_per_tree
118106
self.num_trees = num_trees
119-
self.eval_metrics = eval_metrics
120107

121108
def create_model(self, vpc_config_override=VPC_CONFIG_DEFAULT, **kwargs):
122109
"""Return a :class:`~sagemaker.amazon.RandomCutForestModel` referencing

src/sagemaker/chainer/estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ def create_model(
216216
role or self.role,
217217
entry_point or self._model_entry_point(),
218218
source_dir=(source_dir or self._model_source_dir()),
219-
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
220219
container_log_level=self.container_log_level,
221220
code_location=self.code_location,
222221
py_version=self.py_version,

src/sagemaker/estimator.py

-16
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import logging
1818
import os
1919
import uuid
20-
import warnings
2120
from abc import ABCMeta
2221
from abc import abstractmethod
2322

@@ -46,7 +45,6 @@
4645
from sagemaker.model import (
4746
SCRIPT_PARAM_NAME,
4847
DIR_PARAM_NAME,
49-
CLOUDWATCH_METRICS_PARAM_NAME,
5048
CONTAINER_LOG_LEVEL_PARAM_NAME,
5149
JOB_NAME_PARAM_NAME,
5250
SAGEMAKER_REGION_PARAM_NAME,
@@ -1433,7 +1431,6 @@ def __init__(
14331431
entry_point,
14341432
source_dir=None,
14351433
hyperparameters=None,
1436-
enable_cloudwatch_metrics=False,
14371434
container_log_level=logging.INFO,
14381435
code_location=None,
14391436
image_uri=None,
@@ -1491,9 +1488,6 @@ def __init__(
14911488
SageMaker. For convenience, this accepts other types for keys
14921489
and values, but ``str()`` will be called to convert them before
14931490
training.
1494-
enable_cloudwatch_metrics (bool): [DEPRECATED] Now there are
1495-
cloudwatch metrics emitted by all SageMaker training jobs. This
1496-
will be ignored for now and removed in a further release.
14971491
container_log_level (int): Log level to use within the container
14981492
(default: logging.INFO). Valid values are defined in the Python
14991493
logging module.
@@ -1624,12 +1618,6 @@ def __init__(
16241618
self.dependencies = dependencies or []
16251619
self.uploaded_code = None
16261620

1627-
if enable_cloudwatch_metrics:
1628-
warnings.warn(
1629-
"enable_cloudwatch_metrics is now deprecated and will be removed in the future.",
1630-
DeprecationWarning,
1631-
)
1632-
self.enable_cloudwatch_metrics = False
16331621
self.container_log_level = container_log_level
16341622
self.code_location = code_location
16351623
self.image_uri = image_uri
@@ -1687,7 +1675,6 @@ def _prepare_for_training(self, job_name=None):
16871675
# Modify hyperparameters in-place to point to the right code directory and script URIs
16881676
self._hyperparameters[DIR_PARAM_NAME] = code_dir
16891677
self._hyperparameters[SCRIPT_PARAM_NAME] = script
1690-
self._hyperparameters[CLOUDWATCH_METRICS_PARAM_NAME] = self.enable_cloudwatch_metrics
16911678
self._hyperparameters[CONTAINER_LOG_LEVEL_PARAM_NAME] = self.container_log_level
16921679
self._hyperparameters[JOB_NAME_PARAM_NAME] = self._current_job_name
16931680
self._hyperparameters[SAGEMAKER_REGION_PARAM_NAME] = self.sagemaker_session.boto_region_name
@@ -1798,9 +1785,6 @@ class constructor
17981785
init_params["hyperparameters"].get(SCRIPT_PARAM_NAME)
17991786
)
18001787
init_params["source_dir"] = json.loads(init_params["hyperparameters"].get(DIR_PARAM_NAME))
1801-
init_params["enable_cloudwatch_metrics"] = json.loads(
1802-
init_params["hyperparameters"].get(CLOUDWATCH_METRICS_PARAM_NAME)
1803-
)
18041788
init_params["container_log_level"] = json.loads(
18051789
init_params["hyperparameters"].get(CONTAINER_LOG_LEVEL_PARAM_NAME)
18061790
)

src/sagemaker/model.py

-7
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ def delete_model(self):
599599

600600
SCRIPT_PARAM_NAME = "sagemaker_program"
601601
DIR_PARAM_NAME = "sagemaker_submit_directory"
602-
CLOUDWATCH_METRICS_PARAM_NAME = "sagemaker_enable_cloudwatch_metrics"
603602
CONTAINER_LOG_LEVEL_PARAM_NAME = "sagemaker_container_log_level"
604603
JOB_NAME_PARAM_NAME = "sagemaker_job_name"
605604
MODEL_SERVER_WORKERS_PARAM_NAME = "sagemaker_model_server_workers"
@@ -624,7 +623,6 @@ def __init__(
624623
predictor_cls=None,
625624
env=None,
626625
name=None,
627-
enable_cloudwatch_metrics=False,
628626
container_log_level=logging.INFO,
629627
code_location=None,
630628
sagemaker_session=None,
@@ -682,9 +680,6 @@ def __init__(
682680
when hosted in SageMaker (default: None).
683681
name (str): The model name. If None, a default model name will be
684682
selected on each ``deploy``.
685-
enable_cloudwatch_metrics (bool): Whether training and hosting
686-
containers will generate CloudWatch metrics under the
687-
AWS/SageMakerContainer namespace (default: False).
688683
container_log_level (int): Log level to use within the container
689684
(default: logging.INFO). Valid values are defined in the Python
690685
logging module.
@@ -792,7 +787,6 @@ def __init__(
792787
self.source_dir = source_dir
793788
self.dependencies = dependencies or []
794789
self.git_config = git_config
795-
self.enable_cloudwatch_metrics = enable_cloudwatch_metrics
796790
self.container_log_level = container_log_level
797791
if code_location:
798792
self.bucket, self.key_prefix = fw_utils.parse_s3_url(code_location)
@@ -890,7 +884,6 @@ def _framework_env_vars(self):
890884
return {
891885
SCRIPT_PARAM_NAME.upper(): script_name,
892886
DIR_PARAM_NAME.upper(): dir_name,
893-
CLOUDWATCH_METRICS_PARAM_NAME.upper(): str(self.enable_cloudwatch_metrics).lower(),
894887
CONTAINER_LOG_LEVEL_PARAM_NAME.upper(): str(self.container_log_level),
895888
SAGEMAKER_REGION_PARAM_NAME.upper(): self.sagemaker_session.boto_region_name,
896889
}

src/sagemaker/mxnet/estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ def create_model(
225225
framework_version=self.framework_version,
226226
py_version=self.py_version,
227227
source_dir=(source_dir or self._model_source_dir()),
228-
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
229228
container_log_level=self.container_log_level,
230229
code_location=self.code_location,
231230
model_server_workers=model_server_workers,

src/sagemaker/pytorch/estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def create_model(
179179
framework_version=self.framework_version,
180180
py_version=self.py_version,
181181
source_dir=(source_dir or self._model_source_dir()),
182-
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
183182
container_log_level=self.container_log_level,
184183
code_location=self.code_location,
185184
model_server_workers=model_server_workers,

src/sagemaker/rl/estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ def create_model(
244244
source_dir=source_dir,
245245
code_location=self.code_location,
246246
dependencies=dependencies,
247-
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
248247
)
249248
extended_args.update(base_args)
250249

src/sagemaker/sklearn/estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ def create_model(
201201
role,
202202
entry_point or self._model_entry_point(),
203203
source_dir=(source_dir or self._model_source_dir()),
204-
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
205204
container_log_level=self.container_log_level,
206205
code_location=self.code_location,
207206
py_version=self.py_version,

src/sagemaker/workflow/airflow.py

-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ def prepare_framework(estimator, s3_operations):
5959
]
6060
estimator._hyperparameters[sagemaker.model.DIR_PARAM_NAME] = code_dir
6161
estimator._hyperparameters[sagemaker.model.SCRIPT_PARAM_NAME] = script
62-
estimator._hyperparameters[
63-
sagemaker.model.CLOUDWATCH_METRICS_PARAM_NAME
64-
] = estimator.enable_cloudwatch_metrics
6562
estimator._hyperparameters[
6663
sagemaker.model.CONTAINER_LOG_LEVEL_PARAM_NAME
6764
] = estimator.container_log_level

src/sagemaker/xgboost/estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def create_model(
163163
entry_point or self._model_entry_point(),
164164
framework_version=self.framework_version,
165165
source_dir=(source_dir or self._model_source_dir()),
166-
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
167166
container_log_level=self.container_log_level,
168167
code_location=self.code_location,
169168
py_version=self.py_version,

tests/component/test_mxnet_estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def test_deploy(sagemaker_session, tf_version):
7575
ROLE,
7676
{
7777
"Environment": {
78-
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
7978
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
8079
"SAGEMAKER_SUBMIT_DIRECTORY": SOURCE_DIR,
8180
"SAGEMAKER_REGION": REGION,

tests/component/test_tf_estimator.py

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def test_deploy(sagemaker_session, tf_version):
7474
ROLE,
7575
{
7676
"Environment": {
77-
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
7877
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
7978
"SAGEMAKER_SUBMIT_DIRECTORY": SOURCE_DIR,
8079
"SAGEMAKER_REQUIREMENTS": "",

tests/integ/test_airflow_config.py

-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def test_kmeans_airflow_config_uploads_data_source_to_s3(sagemaker_session, cpu_
111111
kmeans.half_life_time_size = 1
112112
kmeans.epochs = 1
113113
kmeans.center_factor = 1
114-
kmeans.eval_metrics = ["ssd", "msd"]
115114

116115
records = kmeans.record_set(datasets.one_p_mnist()[0][:100])
117116

@@ -386,7 +385,6 @@ def test_rcf_airflow_config_uploads_data_source_to_s3(sagemaker_session, cpu_ins
386385
instance_type=cpu_instance_type,
387386
num_trees=50,
388387
num_samples_per_tree=20,
389-
eval_metrics=["accuracy", "precision_recall_fscore"],
390388
sagemaker_session=sagemaker_session,
391389
)
392390

tests/integ/test_data_capture_config.py

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
ENVIRONMENT = {"env_key_1": "env_value_1"}
3333
TAGS = [{"Key": "tag_key_1", "Value": "tag_value_1"}]
3434
NETWORK_CONFIG = NetworkConfig(enable_network_isolation=True)
35-
ENABLE_CLOUDWATCH_METRICS = True
3635

3736
CUSTOM_SAMPLING_PERCENTAGE = 10
3837
CUSTOM_CAPTURE_OPTIONS = ["REQUEST"]

tests/integ/test_kmeans.py

-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# language governing permissions and limitations under the License.
1313
from __future__ import absolute_import
1414

15-
import json
1615
import time
1716

1817
import pytest
@@ -47,7 +46,6 @@ def test_kmeans(sagemaker_session, cpu_instance_type, training_set):
4746
kmeans.half_life_time_size = 1
4847
kmeans.epochs = 1
4948
kmeans.center_factor = 1
50-
kmeans.eval_metrics = ["ssd", "msd"]
5149

5250
assert kmeans.hyperparameters() == dict(
5351
init_method=kmeans.init_method,
@@ -59,7 +57,6 @@ def test_kmeans(sagemaker_session, cpu_instance_type, training_set):
5957
epochs=str(kmeans.epochs),
6058
extra_center_factor=str(kmeans.center_factor),
6159
k=str(kmeans.k),
62-
eval_metrics=json.dumps(kmeans.eval_metrics),
6360
force_dense="True",
6461
)
6562

tests/integ/test_multidatamodel.py

-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ def __rcf_training_job(
439439
instance_type=cpu_instance_type,
440440
num_trees=num_trees,
441441
num_samples_per_tree=num_samples_per_tree,
442-
eval_metrics=["accuracy", "precision_recall_fscore"],
443442
sagemaker_session=sagemaker_session,
444443
)
445444

tests/unit/sagemaker/model/test_framework_model.py

-4
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def test_prepare_container_def(time, sagemaker_session):
106106
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://mybucket/mi-2017-10-10-14-14-15/sourcedir.tar.gz",
107107
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
108108
"SAGEMAKER_REGION": REGION,
109-
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
110109
},
111110
"Image": MODEL_IMAGE,
112111
"ModelDataUrl": MODEL_DATA,
@@ -125,7 +124,6 @@ def test_prepare_container_def_with_network_isolation(time, sagemaker_session):
125124
"SAGEMAKER_SUBMIT_DIRECTORY": "/opt/ml/model/code",
126125
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
127126
"SAGEMAKER_REGION": REGION,
128-
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
129127
},
130128
"Image": MODEL_IMAGE,
131129
"ModelDataUrl": MODEL_DATA,
@@ -144,7 +142,6 @@ def test_prepare_container_def_no_model_defaults(sagemaker_session, tmpdir):
144142
source_dir="sd",
145143
env={"a": "a"},
146144
name="name",
147-
enable_cloudwatch_metrics=True,
148145
container_log_level=55,
149146
code_location="s3://cb/cp",
150147
)
@@ -155,7 +152,6 @@ def test_prepare_container_def_no_model_defaults(sagemaker_session, tmpdir):
155152
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://cb/cp/name/sourcedir.tar.gz",
156153
"SAGEMAKER_CONTAINER_LOG_LEVEL": "55",
157154
"SAGEMAKER_REGION": REGION,
158-
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "true",
159155
"a": "a",
160156
},
161157
"Image": MODEL_IMAGE,

tests/unit/sagemaker/tensorflow/test_estimator.py

-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ def _hyperparameters(horovod=False):
8888
"sagemaker_submit_directory": json.dumps(
8989
"s3://{}/{}/source/sourcedir.tar.gz".format(BUCKET_NAME, JOB_NAME)
9090
),
91-
"sagemaker_enable_cloudwatch_metrics": "false",
9291
"sagemaker_container_log_level": str(logging.INFO),
9392
"sagemaker_job_name": json.dumps(JOB_NAME),
9493
"sagemaker_region": json.dumps("us-west-2"),
@@ -220,7 +219,6 @@ def test_create_model_with_optional_params(
220219

221220
container_log_level = '"logging.INFO"'
222221
source_dir = "s3://mybucket/source"
223-
enable_cloudwatch_metrics = "true"
224222
tf = TensorFlow(
225223
entry_point=SCRIPT_PATH,
226224
framework_version=tensorflow_inference_version,
@@ -232,7 +230,6 @@ def test_create_model_with_optional_params(
232230
container_log_level=container_log_level,
233231
base_job_name="job",
234232
source_dir=source_dir,
235-
enable_cloudwatch_metrics=enable_cloudwatch_metrics,
236233
output_path="s3://mybucket/output",
237234
)
238235

0 commit comments

Comments
 (0)