Skip to content

Commit c389c72

Browse files
change: include additional docstyle improvements (#1889)
Co-authored-by: Ajay Karpur <[email protected]>
1 parent 2b812c8 commit c389c72

20 files changed

+196
-131
lines changed

.pydocstylerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[pydocstyle]
22
inherit = false
3-
ignore = D104,D107,D202,D203,D205,D209,D212,D213,D214,D400,D401,D404,D406,D407,D411,D413,D414,D415,D417
3+
ignore = D104,D107,D202,D203,D205,D212,D213,D214,D400,D401,D404,D406,D407,D411,D413,D414,D415,D417
44
match = (?!record_pb2).*\.py

src/sagemaker/amazon/factorization_machines.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class FactorizationMachines(AmazonAlgorithmEstimatorBase):
3030
Factorization Machines combine the advantages of Support Vector Machines
3131
with factorization models. It is an extension of a linear model that is
3232
designed to capture interactions between features within high dimensional
33-
sparse datasets economically."""
33+
sparse datasets economically.
34+
"""
3435

3536
repo_name = "factorization-machines"
3637
repo_version = 1

src/sagemaker/amazon/ipinsights.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class IPInsights(AmazonAlgorithmEstimatorBase):
2929
"""An unsupervised learning algorithm that learns the usage patterns for IPv4 addresses.
3030
3131
It is designed to capture associations between IPv4 addresses and various entities, such
32-
as user IDs or account numbers."""
32+
as user IDs or account numbers.
33+
"""
3334

3435
repo_name = "ipinsights"
3536
repo_version = 1

src/sagemaker/amazon/kmeans.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class KMeans(AmazonAlgorithmEstimatorBase):
2929
3030
As the result of KMeans, members of a group are as similar as possible to one another and as
3131
different as possible from members of other groups. You define the attributes that you want
32-
the algorithm to use to determine similarity."""
32+
the algorithm to use to determine similarity.
33+
"""
3334

3435
repo_name = "kmeans"
3536
repo_version = 1

src/sagemaker/amazon/knn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class KNN(AmazonAlgorithmEstimatorBase):
3030
For classification problems, the algorithm queries the k points that are closest to the sample
3131
point and returns the most frequently used label of their class as the predicted label. For
3232
regression problems, the algorithm queries the k closest points to the sample point and returns
33-
the average of their feature values as the predicted value."""
33+
the average of their feature values as the predicted value.
34+
"""
3435

3536
repo_name = "knn"
3637
repo_version = 1

src/sagemaker/amazon/lda.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class LDA(AmazonAlgorithmEstimatorBase):
3030
LDA is most commonly used to discover a
3131
user-specified number of topics shared by documents within a text corpus. Here each
3232
observation is a document, the features are the presence (or occurrence count) of each
33-
word, and the categories are the topics."""
33+
word, and the categories are the topics.
34+
"""
3435

3536
repo_name = "lda"
3637
repo_version = 1

src/sagemaker/amazon/linear_learner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class LinearLearner(AmazonAlgorithmEstimatorBase):
3232
For multiclass classification problems, the labels must be from 0 to num_classes - 1. For
3333
regression problems, y is a real number. The algorithm learns a linear function, or, for
3434
classification problems, a linear threshold function, and maps a vector x to an approximation
35-
of the label y."""
35+
of the label y.
36+
"""
3637

3738
repo_name = "linear-learner"
3839
repo_version = 1

src/sagemaker/amazon/ntm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525

2626

2727
class NTM(AmazonAlgorithmEstimatorBase):
28-
"""An unsupervised learning algorithm used to organize a corpus of documents into topics
28+
"""An unsupervised learning algorithm used to organize a corpus of documents into topics.
2929
3030
The resulting topics contain word groupings based on their statistical distribution.
3131
Documents that contain frequent occurrences of words such as "bike", "car", "train",
32-
"mileage", and "speed" are likely to share a topic on "transportation" for example."""
32+
"mileage", and "speed" are likely to share a topic on "transportation" for example.
33+
"""
3334

3435
repo_name = "ntm"
3536
repo_version = 1

src/sagemaker/amazon/object2vec.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525

2626
def _list_check_subset(valid_super_list):
27-
"""
27+
"""Provides a function to check validity of list subset.
28+
2829
Args:
2930
valid_super_list:
3031
"""
@@ -45,7 +46,8 @@ class Object2Vec(AmazonAlgorithmEstimatorBase):
4546
4647
It can learn low-dimensional dense embeddings of high-dimensional objects. The embeddings
4748
are learned in a way that preserves the semantics of the relationship between pairs of
48-
objects in the original space in the embedding space."""
49+
objects in the original space in the embedding space.
50+
"""
4951

5052
repo_name = "object2vec"
5153
repo_version = 1

src/sagemaker/amazon/pca.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class PCA(AmazonAlgorithmEstimatorBase):
2828
"""An unsupervised machine learning algorithm to reduce feature dimensionality.
2929
3030
As a result, number of features within a dataset is reduced but the dataset still
31-
retain as much information as possible."""
31+
retain as much information as possible.
32+
"""
3233

3334
repo_name = "pca"
3435
repo_version = 1

src/sagemaker/amazon/randomcutforest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class RandomCutForest(AmazonAlgorithmEstimatorBase):
2929
3030
These are observations which diverge from otherwise well-structured or patterned data.
3131
Anomalies can manifest as unexpected spikes in time series data, breaks in periodicity,
32-
or unclassifiable data points."""
32+
or unclassifiable data points.
33+
"""
3334

3435
repo_name = "randomcutforest"
3536
repo_version = 1

src/sagemaker/automl/automl.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
class AutoML(object):
29-
"""A class for creating and interacting with SageMaker AutoML jobs"""
29+
"""A class for creating and interacting with SageMaker AutoML jobs."""
3030

3131
def __init__(
3232
self,
@@ -178,14 +178,14 @@ def describe_auto_ml_job(self, job_name=None):
178178
return self._auto_ml_job_desc
179179

180180
def best_candidate(self, job_name=None):
181-
"""Returns the best candidate of an AutoML job for a given name
181+
"""Returns the best candidate of an AutoML job for a given name.
182182
183183
Args:
184184
job_name (str): The name of the AutoML job. If None, will use object's
185185
_current_auto_ml_job_name.
186186
187187
Returns:
188-
dict: a dictionary with information of the best candidate
188+
dict: A dictionary with information of the best candidate.
189189
"""
190190
if self._best_candidate:
191191
return self._best_candidate
@@ -229,7 +229,7 @@ def list_candidates(
229229
between 1 to 100. Default to None. If None, will return all the candidates.
230230
231231
Returns:
232-
list: A list of dictionaries with candidates information
232+
list: A list of dictionaries with candidates information.
233233
"""
234234
if job_name is None:
235235
job_name = self.current_job_name
@@ -262,8 +262,7 @@ def create_model(
262262
predictor_cls=None,
263263
inference_response_keys=None,
264264
):
265-
"""Creates a model from a given candidate or the best candidate
266-
from the automl job
265+
"""Creates a model from a given candidate or the best candidate from the job.
267266
268267
Args:
269268
name (str): The pipeline model name.
@@ -289,7 +288,7 @@ def create_model(
289288
keys will dictate the content order in the response.
290289
291290
Returns:
292-
PipelineModel object
291+
PipelineModel object.
293292
"""
294293
sagemaker_session = sagemaker_session or self.sagemaker_session
295294

@@ -351,7 +350,7 @@ def deploy(
351350
predictor_cls=None,
352351
inference_response_keys=None,
353352
):
354-
"""Deploy a candidate to a SageMaker Inference Pipeline and return a Predictor
353+
"""Deploy a candidate to a SageMaker Inference Pipeline.
355354
356355
Args:
357356
initial_instance_count (int): The initial number of instances to run
@@ -490,12 +489,14 @@ def _get_supported_inference_keys(cls, container, default=None):
490489

491490
@classmethod
492491
def _check_inference_keys(cls, inference_response_keys, containers):
493-
"""Given an inference container list, checks if the pipeline supports the
494-
requested inference keys
492+
"""Checks if the pipeline supports the inference keys for the containers.
493+
494+
Given inference response keys and list of containers, determines whether
495+
the keys are supported.
495496
496497
Args:
497-
inference_response_keys (list): List of keys for inference response content
498-
containers (list): list of inference container
498+
inference_response_keys (list): List of keys for inference response content.
499+
containers (list): list of inference container.
499500
500501
Raises:
501502
ValueError, if one or more keys in inference_response_keys are not supported
@@ -527,8 +528,10 @@ def _check_inference_keys(cls, inference_response_keys, containers):
527528

528529
@classmethod
529530
def validate_and_update_inference_response(cls, inference_containers, inference_response_keys):
530-
"""Validates the requested inference keys and updates inference containers to emit the
531-
requested content in the inference response.
531+
"""Validates the requested inference keys and updates response content.
532+
533+
On validation, also updates the inference containers to emit appropriate response
534+
content in the inference response.
532535
533536
Args:
534537
inference_containers (list): list of inference containers
@@ -570,8 +573,10 @@ def validate_and_update_inference_response(cls, inference_containers, inference_
570573

571574

572575
class AutoMLInput(object):
573-
"""Accepts parameters that specify an S3 input for an auto ml job and provides
574-
a method to turn those parameters into a dictionary."""
576+
"""Accepts parameters that specify an S3 input for an auto ml job
577+
578+
Provides a method to turn those parameters into a dictionary.
579+
"""
575580

576581
def __init__(self, inputs, target_attribute_name, compression=None):
577582
"""Convert an S3 Uri or a list of S3 Uri to an AutoMLInput object.

src/sagemaker/debugger.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,15 @@ def _to_request_dict(self):
320320

321321

322322
class TensorBoardOutputConfig(object):
323-
"""TensorBoardOutputConfig provides options to customize
324-
debugging visualization using TensorBoard."""
323+
"""A configuration object to provide debugging customizations.
324+
325+
A configuration specific to TensorBoard output, that provides options
326+
to customize debugging visualizations using TensorBoard.
327+
"""
325328

326329
def __init__(self, s3_output_path, container_local_output_path=None):
327330
"""Initialize an instance of TensorBoardOutputConfig.
331+
328332
TensorBoardOutputConfig provides options to customize
329333
debugging visualization using TensorBoard.
330334
@@ -336,8 +340,7 @@ def __init__(self, s3_output_path, container_local_output_path=None):
336340
self.container_local_output_path = container_local_output_path
337341

338342
def _to_request_dict(self):
339-
"""Generates a request dictionary using the parameters provided
340-
when initializing the object.
343+
"""Generates a request dictionary using the instances attributes.
341344
342345
Returns:
343346
dict: An portion of an API request as a dictionary.

0 commit comments

Comments
 (0)