Commit 901012eb authored by liuzhe-lz's avatar liuzhe-lz Committed by QuanluZhang
Browse files

docstring fix (#1691)

parent 2d375f43
...@@ -53,14 +53,14 @@ class Assessor(Recoverable): ...@@ -53,14 +53,14 @@ class Assessor(Recoverable):
to tell whether this trial can be early stopped or not. to tell whether this trial can be early stopped or not.
This is the abstract base class for all assessors. 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. which receives intermediate results from trials and give an assessing result.
If :meth:`assess_trial` returns :obj:`AssessResult.Bad` for a trial, 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, it hints NNI framework that the trial is likely to result in a poor final accuracy,
and therefore should be killed to save resource. 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. To write a new assessor, you can reference :class:`~nni.medianstop_assessor.MedianstopAssessor`'s code as an example.
...@@ -77,7 +77,7 @@ class Assessor(Recoverable): ...@@ -77,7 +77,7 @@ class Assessor(Recoverable):
The NNI framework has little guarantee on ``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. 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. 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. The only guarantee is that ``trial_history`` is always growing.
...@@ -96,9 +96,9 @@ class Assessor(Recoverable): ...@@ -96,9 +96,9 @@ class Assessor(Recoverable):
Parameters Parameters
---------- ----------
trial_job_id: str trial_job_id : str
Unique identifier of the trial. Unique identifier of the trial.
trial_history: list trial_history : list
Intermediate results of this trial. The element type is decided by trial code. Intermediate results of this trial. The element type is decided by trial code.
Returns Returns
...@@ -114,9 +114,9 @@ class Assessor(Recoverable): ...@@ -114,9 +114,9 @@ class Assessor(Recoverable):
Parameters Parameters
---------- ----------
trial_job_id: str trial_job_id : str
Unique identifier of the trial. Unique identifier of the trial.
success: bool success : bool
True if the trial successfully completed; False if failed or terminated. True if the trial successfully completed; False if failed or terminated.
""" """
......
...@@ -42,7 +42,7 @@ class Tuner(Recoverable): ...@@ -42,7 +42,7 @@ class Tuner(Recoverable):
A new trial will run with this configuration. A new trial will run with this configuration.
This is the abstract base class for all tuners. 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`. 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, After initializing, NNI will first call :meth:`update_search_space` to tell tuner the feasible region,
...@@ -96,9 +96,9 @@ class Tuner(Recoverable): ...@@ -96,9 +96,9 @@ class Tuner(Recoverable):
Parameters Parameters
---------- ----------
parameter_id: int parameter_id : int
Unique identifier for requested hyper-parameters. This will later be used in :meth:`receive_trial_result`. 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. Unstable parameters which should be ignored by normal users.
Returns Returns
...@@ -129,10 +129,10 @@ class Tuner(Recoverable): ...@@ -129,10 +129,10 @@ class Tuner(Recoverable):
Parameters Parameters
---------- ----------
parameter_id_list: list of int parameter_id_list : list of int
Unique identifiers for each set of requested hyper-parameters. Unique identifiers for each set of requested hyper-parameters.
These will later be used in :meth:`receive_trial_result`. These will later be used in :meth:`receive_trial_result`.
**kwargs: **kwargs
Unstable parameters which should be ignored by normal users. Unstable parameters which should be ignored by normal users.
Returns Returns
...@@ -159,13 +159,13 @@ class Tuner(Recoverable): ...@@ -159,13 +159,13 @@ class Tuner(Recoverable):
Parameters Parameters
---------- ----------
parameter_id: int parameter_id : int
Unique identifier of used hyper-parameters, same with :meth:`generate_parameters`. Unique identifier of used hyper-parameters, same with :meth:`generate_parameters`.
parameters parameters
Hyper-parameters generated by :meth:`generate_parameters`. Hyper-parameters generated by :meth:`generate_parameters`.
value value
Result from trial (the return value of :func:`nni.report_final_result`). Result from trial (the return value of :func:`nni.report_final_result`).
**kwargs: **kwargs
Unstable parameters which should be ignored by normal users. Unstable parameters which should be ignored by normal users.
""" """
raise NotImplementedError('Tuner: receive_trial_result not implemented') raise NotImplementedError('Tuner: receive_trial_result not implemented')
...@@ -186,11 +186,11 @@ class Tuner(Recoverable): ...@@ -186,11 +186,11 @@ class Tuner(Recoverable):
Parameters Parameters
---------- ----------
parameter_id: int parameter_id : int
Unique identifier for hyper-parameters used by this trial. Unique identifier for hyper-parameters used by this trial.
success: bool success : bool
True if the trial successfully completed; False if failed or terminated. True if the trial successfully completed; False if failed or terminated.
**kwargs: **kwargs
Unstable parameters which should be ignored by normal users. Unstable parameters which should be ignored by normal users.
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment