@@ -64,25 +64,24 @@ def _fetch_dataframe(self):
6464 pass
6565
6666 def clear_cache (self ):
67- """Clears the object of all local caches of API methods, so
67+ """Clear the object of all local caches of API methods, so
6868 that the next time any properties are accessed they will be refreshed from
6969 the service.
7070 """
7171 self ._dataframe = None
7272
7373
7474class HyperparameterTuningJobAnalytics (AnalyticsMetricsBase ):
75- """Fetches results about this tuning job and makes them accessible for analytics.
75+ """Fetch results about a hyperparameter tuning job and make them accessible for analytics.
7676 """
7777
7878 def __init__ (self , hyperparameter_tuning_job_name , sagemaker_session = None ):
79- """Initialize an ``HyperparameterTuningJobAnalytics`` instance.
79+ """Initialize a ``HyperparameterTuningJobAnalytics`` instance.
8080
8181 Args:
82- hyperparameter_tuning_job_name (str): name of the HyperparameterTuningJob to
83- analyze.
82+ hyperparameter_tuning_job_name (str): name of the HyperparameterTuningJob to analyze.
8483 sagemaker_session (sagemaker.session.Session): Session object which manages interactions with
85- Amazon SageMaker APIs and any other AWS services needed. If not specified, the estimator creates one
84+ Amazon SageMaker APIs and any other AWS services needed. If not specified, one is created
8685 using the default AWS configuration chain.
8786 """
8887 sagemaker_session = sagemaker_session or Session ()
@@ -100,16 +99,16 @@ def __repr__(self):
10099 return "<sagemaker.HyperparameterTuningJobAnalytics for %s>" % self .name
101100
102101 def clear_cache (self ):
103- """Clears the object of all local caches of API methods.
102+ """Clear the object of all local caches of API methods.
104103 """
105104 super (HyperparameterTuningJobAnalytics , self ).clear_cache ()
106105 self ._tuning_job_describe_result = None
107106 self ._training_job_summaries = None
108107
109108 def _fetch_dataframe (self ):
110- """Returns a pandas dataframe with all the training jobs, their
111- hyperparameters, results, and metadata about the training jobs.
112- Includes a column to indicate that any job was the best seen so far.
109+ """Return a pandas dataframe with all the training jobs, along with their
110+ hyperparameters, results, and metadata. This also includes a column to indicate
111+ if a training job was the best seen so far.
113112 """
114113 def reshape (training_summary ):
115114 # Helper method to reshape a single training job summary into a dataframe record
@@ -139,8 +138,8 @@ def reshape(training_summary):
139138
140139 @property
141140 def tuning_ranges (self ):
142- """A dict describing the ranges of all tuned hyperparameters.
143- Dict's key is the name of the hyper param. Dict's value is the range .
141+ """A dictionary describing the ranges of all tuned hyperparameters.
142+ The keys are the names of the hyperparameter, and the values are the ranges .
144143 """
145144 out = {}
146145 for _ , ranges in self .description ()['HyperParameterTuningJobConfig' ]['ParameterRanges' ].items ():
@@ -149,10 +148,13 @@ def tuning_ranges(self):
149148 return out
150149
151150 def description (self , force_refresh = False ):
152- """Response to DescribeHyperParameterTuningJob
151+ """Call `` DescribeHyperParameterTuningJob`` for the hyperparameter tuning job.
153152
154153 Args:
155154 force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
155+
156+ Returns:
157+ dict: The Amazon SageMaker response for ``DescribeHyperParameterTuningJob``.
156158 """
157159 if force_refresh :
158160 self .clear_cache ()
@@ -163,10 +165,13 @@ def description(self, force_refresh=False):
163165 return self ._tuning_job_describe_result
164166
165167 def training_job_summaries (self , force_refresh = False ):
166- """A list of everything (paginated) from ListTrainingJobsForTuningJob
168+ """A (paginated) list of everything from `` ListTrainingJobsForTuningJob``.
167169
168170 Args:
169171 force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
172+
173+ Returns:
174+ dict: The Amazon SageMaker response for ``ListTrainingJobsForTuningJob``.
170175 """
171176 if force_refresh :
172177 self .clear_cache ()
@@ -191,19 +196,19 @@ def training_job_summaries(self, force_refresh=False):
191196
192197
193198class TrainingJobAnalytics (AnalyticsMetricsBase ):
194- """Fetches training curve data from CloudWatch Metrics for a specific training job.
199+ """Fetch training curve data from CloudWatch Metrics for a specific training job.
195200 """
196201
197202 CLOUDWATCH_NAMESPACE = '/aws/sagemaker/HyperParameterTuningJobs'
198203
199204 def __init__ (self , training_job_name , metric_names , sagemaker_session = None ):
200- """Initialize an ``TrainingJobAnalytics`` instance.
205+ """Initialize a ``TrainingJobAnalytics`` instance.
201206
202207 Args:
203208 training_job_name (str): name of the TrainingJob to analyze.
204209 metric_names (list): string names of all the metrics to collect for this training job
205210 sagemaker_session (sagemaker.session.Session): Session object which manages interactions with
206- Amazon SageMaker APIs and any other AWS services needed. If not specified, the estimator creates one
211+ Amazon SageMaker APIs and any other AWS services needed. If not specified, one is specified
207212 using the default AWS configuration chain.
208213 """
209214 sagemaker_session = sagemaker_session or Session ()
@@ -223,7 +228,7 @@ def __repr__(self):
223228 return "<sagemaker.TrainingJobAnalytics for %s>" % self .name
224229
225230 def clear_cache (self ):
226- """Clears the object of all local caches of API methods, so
231+ """Clear the object of all local caches of API methods, so
227232 that the next time any properties are accessed they will be refreshed from
228233 the service.
229234 """
@@ -232,7 +237,7 @@ def clear_cache(self):
232237 self ._time_interval = self ._determine_timeinterval ()
233238
234239 def _determine_timeinterval (self ):
235- """Returns a dict with two datetime objects, start_time and end_time
240+ """Return a dictionary with two datetime objects, start_time and end_time,
236241 covering the interval of the training job
237242 """
238243 description = self ._sage_client .describe_training_job (TrainingJobName = self .name )
@@ -249,7 +254,7 @@ def _fetch_dataframe(self):
249254 return pd .DataFrame (self ._data )
250255
251256 def _fetch_metric (self , metric_name ):
252- """Fetches all the values of a named metric, and adds them to _data
257+ """Fetch all the values of a named metric, and add them to _data
253258 """
254259 request = {
255260 'Namespace' : self .CLOUDWATCH_NAMESPACE ,
@@ -284,7 +289,7 @@ def _fetch_metric(self, metric_name):
284289 self ._add_single_metric (elapsed_seconds , metric_name , value )
285290
286291 def _add_single_metric (self , timestamp , metric_name , value ):
287- """Stores a single metric in the _data dict which can be
292+ """Store a single metric in the _data dict which can be
288293 converted to a dataframe.
289294 """
290295 # note that this method is built this way to make it possible to
0 commit comments