From 901012eb90bf7c0dbb3d2566e5d8c0eda1b5b249 Mon Sep 17 00:00:00 2001 From: liuzhe-lz <40699903+liuzhe-lz@users.noreply.github.com> Date: Sat, 9 Nov 2019 12:43:02 +0800 Subject: [PATCH] docstring fix (#1691) --- src/sdk/pynni/nni/assessor.py | 14 +++++++------- src/sdk/pynni/nni/tuner.py | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/sdk/pynni/nni/assessor.py b/src/sdk/pynni/nni/assessor.py index 0f1dc95619..01a2abcbe9 100644 --- a/src/sdk/pynni/nni/assessor.py +++ b/src/sdk/pynni/nni/assessor.py @@ -53,14 +53,14 @@ class Assessor(Recoverable): to tell whether this trial can be early stopped or not. This is the abstract base class for all assessors. - Early stopping algorithms should derive this class and override :meth:`assess_trial` method, + Early stopping algorithms should inherit this class and override :meth:`assess_trial` method, which receives intermediate results from trials and give an assessing result. If :meth:`assess_trial` returns :obj:`AssessResult.Bad` for a trial, it hints NNI framework that the trial is likely to result in a poor final accuracy, and therefore should be killed to save resource. - If an accessor want's to get notified when a trial ends, it can also override :meth:`trial_end`. + If an accessor want's to be notified when a trial ends, it can also override :meth:`trial_end`. To write a new assessor, you can reference :class:`~nni.medianstop_assessor.MedianstopAssessor`'s code as an example. @@ -77,7 +77,7 @@ def assess_trial(self, trial_job_id, trial_history): The NNI framework has little guarantee on ``trial_history``. This method is not guaranteed to be invoked for each time ``trial_history`` get updated. - It is also possible that a trial's history keeps updateing after receiving a bad result. + It is also possible that a trial's history keeps updating after receiving a bad result. And if the trial failed and retried, ``trial_history`` may be inconsistent with its previous value. The only guarantee is that ``trial_history`` is always growing. @@ -96,9 +96,9 @@ def assess_trial(self, trial_job_id, trial_history): Parameters ---------- - trial_job_id: str + trial_job_id : str Unique identifier of the trial. - trial_history: list + trial_history : list Intermediate results of this trial. The element type is decided by trial code. Returns @@ -114,9 +114,9 @@ def trial_end(self, trial_job_id, success): Parameters ---------- - trial_job_id: str + trial_job_id : str Unique identifier of the trial. - success: bool + success : bool True if the trial successfully completed; False if failed or terminated. """ diff --git a/src/sdk/pynni/nni/tuner.py b/src/sdk/pynni/nni/tuner.py index f011022151..177232b7ed 100644 --- a/src/sdk/pynni/nni/tuner.py +++ b/src/sdk/pynni/nni/tuner.py @@ -42,7 +42,7 @@ class Tuner(Recoverable): A new trial will run with this configuration. This is the abstract base class for all tuners. - Tuning algorithms should derive this class and override :meth:`update_search_space`, :meth:`receive_trial_result`, + Tuning algorithms should inherit this class and override :meth:`update_search_space`, :meth:`receive_trial_result`, as well as :meth:`generate_parameters` or :meth:`generate_multiple_parameters`. After initializing, NNI will first call :meth:`update_search_space` to tell tuner the feasible region, @@ -96,9 +96,9 @@ def generate_parameters(self, parameter_id, **kwargs): Parameters ---------- - parameter_id: int + parameter_id : int Unique identifier for requested hyper-parameters. This will later be used in :meth:`receive_trial_result`. - **kwargs: + **kwargs Unstable parameters which should be ignored by normal users. Returns @@ -129,10 +129,10 @@ def generate_multiple_parameters(self, parameter_id_list, **kwargs): Parameters ---------- - parameter_id_list: list of int + parameter_id_list : list of int Unique identifiers for each set of requested hyper-parameters. These will later be used in :meth:`receive_trial_result`. - **kwargs: + **kwargs Unstable parameters which should be ignored by normal users. Returns @@ -159,13 +159,13 @@ def receive_trial_result(self, parameter_id, parameters, value, **kwargs): Parameters ---------- - parameter_id: int + parameter_id : int Unique identifier of used hyper-parameters, same with :meth:`generate_parameters`. parameters Hyper-parameters generated by :meth:`generate_parameters`. value Result from trial (the return value of :func:`nni.report_final_result`). - **kwargs: + **kwargs Unstable parameters which should be ignored by normal users. """ raise NotImplementedError('Tuner: receive_trial_result not implemented') @@ -186,11 +186,11 @@ def trial_end(self, parameter_id, success, **kwargs): Parameters ---------- - parameter_id: int + parameter_id : int Unique identifier for hyper-parameters used by this trial. - success: bool + success : bool True if the trial successfully completed; False if failed or terminated. - **kwargs: + **kwargs Unstable parameters which should be ignored by normal users. """