Skip to content

Commit e105516

Browse files
MarkDaoustTensorflow Cloud maintainers
authored andcommitted
Fix docstring format.
PiperOrigin-RevId: 374921762
1 parent 00ed5ca commit e105516

File tree

1 file changed

+42
-74
lines changed
  • src/python/tensorflow_cloud/tuner

1 file changed

+42
-74
lines changed

src/python/tensorflow_cloud/tuner/tuner.py

Lines changed: 42 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -71,42 +71,22 @@ class CloudOracle(oracle_module.Oracle):
7171
many different hyperparameters, it can be difficult and time consuming to
7272
tune them manually. AI Platform Vizier optimizes your model's output by
7373
tuning the hyperparameters for you.
74-
To learn more about AI Platfrom Vizier service see:
74+
To learn more about AI Platform Vizier service see:
7575
https://cloud.google.com/ai-platform/optimizer/docs/overview.
7676
77-
Examples:
78-
>>> oracle = CloudOracle(
79-
project_id=project_id,
80-
region='us-central1',
81-
objective='accuracy',
82-
hyperparameters=hyperparameters,
83-
study_config=None,
84-
max_trials=4,
85-
study_id=None,
86-
)
87-
88-
Args:
89-
project_id: A GCP project id.
90-
region: A GCP region. e.g. 'us-central1'.
91-
objective: If a string, the direction of the optimization (min or
92-
max) will be inferred.
93-
hyperparameters: Mandatory and must include definitions for all
94-
hyperparameters used during the search. Can be used to override
95-
(or register in advance) hyperparameters in the search space.
96-
study_config: Study configuration for Vizier service.
97-
max_trials: Total number of trials (model configurations) to test at
98-
most. If None, it continues the search until it reaches the
99-
Vizier trial limit for each study. Users may stop the search
100-
externally (e.g. by killing the job). Note that the Oracle may
101-
interrupt the search before `max_trials` models have been
102-
tested.
103-
study_id: An identifier of the study. If not supplied,
104-
system-determined unique ID is given.
105-
The full study name will be
106-
`projects/{project_id}/locations/{region}/studies/{study_id}`,
107-
and the full trial name will be
108-
`{study name}/trials/{trial_id}`.
109-
)
77+
Examples:
78+
79+
```
80+
oracle = CloudOracle(
81+
project_id=project_id,
82+
region='us-central1',
83+
objective='accuracy',
84+
hyperparameters=hyperparameters,
85+
study_config=None,
86+
max_trials=4,
87+
study_id=None,
88+
)
89+
```
11090
"""
11191

11292
def __init__(
@@ -132,15 +112,18 @@ def __init__(
132112
https://keras-team.github.io/keras-tuner/documentation/oracles/
133113
134114
Examples:
135-
>>> oracle = CloudOracle(
136-
project_id=project_id,
137-
region='us-central1',
138-
objective='accuracy',
139-
hyperparameters=hyperparameters,
140-
study_config=None,
141-
max_trials=4,
142-
study_id=None,
143-
)
115+
116+
```
117+
oracle = CloudOracle(
118+
project_id=project_id,
119+
region='us-central1',
120+
objective='accuracy',
121+
hyperparameters=hyperparameters,
122+
study_config=None,
123+
max_trials=4,
124+
study_id=None,
125+
)
126+
```
144127
145128
Args:
146129
project_id: A GCP project id.
@@ -450,37 +433,22 @@ class CloudTuner(tuner_module.Tuner):
450433
CloudTuner is a implementation of KerasTuner that uses Google Cloud Vizier
451434
Service as its Oracle. To learn more about KerasTuner and Oracles please
452435
refer to:
453-
https://keras-team.github.io/keras-tuner/
454-
https://keras-team.github.io/keras-tuner/documentation/oracles/
455-
456-
Args:
457-
hypermodel: Instance of HyperModel class (or callable that takes
458-
hyperparameters and returns a Model instance).
459-
project_id: A GCP project id.
460-
region: A GCP region. e.g. 'us-central1'.
461-
objective: Name of model metric to minimize or maximize, e.g.
462-
"val_accuracy".
463-
hyperparameters: Can be used to override (or register in advance)
464-
hyperparameters in the search space.
465-
study_config: Study configuration for Vizier service.
466-
max_trials: Total number of trials (model configurations) to test at
467-
most. Note that the oracle may interrupt the search before
468-
`max_trials` models have been tested if the search space has
469-
been exhausted.
470-
study_id: An identifier of the study. The full study name will be
471-
projects/{project_id}/locations/{region}/studies/{study_id}.
472-
**kwargs: Keyword arguments relevant to all `Tuner` subclasses.
473-
Please see the docstring for `Tuner`.
474-
475-
Example:
476-
>>> tuner = CloudTuner(
477-
build_model,
478-
project_id="MY_PROJECT_ID",
479-
region='us-central1',
480-
objective='accuracy',
481-
hyperparameters=HPS,
482-
max_trials=5,
483-
directory='tmp/MY_JOB')
436+
437+
* https://keras-team.github.io/keras-tuner/
438+
* https://keras-team.github.io/keras-tuner/documentation/oracles/
439+
440+
Example:
441+
442+
```
443+
tuner = CloudTuner(
444+
build_model,
445+
project_id="MY_PROJECT_ID",
446+
region='us-central1',
447+
objective='accuracy',
448+
hyperparameters=HPS,
449+
max_trials=5,
450+
directory='tmp/MY_JOB')
451+
```
484452
"""
485453

486454
def __init__(

0 commit comments

Comments
 (0)