Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

docstr/pylint of GP Tuner & CurveFitting Assessor #1692

Merged
merged 13 commits into from
Nov 11, 2019

Conversation

suiguoxin
Copy link
Member

No description provided.

@@ -100,6 +102,7 @@ def logx_linear(x, a, b):
float
a * np.log(x) + b
"""
# pylint: disable=assignment-from-no-return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed.

@@ -308,6 +308,7 @@ def mcmc_sampling(self):
new_values = np.random.randn(NUM_OF_INSTANCE, self.effective_model_num) * STEP_SIZE + self.weight_samples
new_values = self.normalize_weight(new_values)
# compute alpha(i, j) = min{1, P(j)Q(j, i)/P(i)Q(i, j)}
# pylint: disable=assignment-from-no-return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed. Use latest pylintrc.

"""
GPTuner is a Bayesian Optimization method where Gaussian Process is used for modeling loss functions.

See : class:`GPTuner` for details.
Copy link
Contributor

@liuzhe-lz liuzhe-lz Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after colon. :class:`ClassName` is the syntax of sphinx cross-reference.


import warnings
import logging
import numpy as np

# pylint: disable=no-name-in-module, import-error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ? This is not included in pylintrc


Parameters
----------
optimize_mode: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space before colon here. My example was incorrect.

----------
optimize_mode: str
optimize mode, 'maximize' or 'minimize', by default 'maximize'
utility: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented attributes are public APIs. Use underscore name for internal states.

Parameters
----------
search_space : dict
Override of the abstract method in class:`Tuner`.
Copy link
Contributor

@liuzhe-lz liuzhe-lz Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please build and check html locally.
If this link does not work, it should be :class:`~nni.tuner.Tuner`.


Returns
-------
result: tuple
Copy link
Contributor

@liuzhe-lz liuzhe-lz Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numpy format "returns" does not include a name.

@suiguoxin
Copy link
Member Author

Updates:

  • Updated according to your comments
  • refactor of medianstop assessor docstr


Parameters
----------
vals :numpy array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after colon


Parameters
----------
:param f_acq:
param f_acq : UtilityFunction.utility
Copy link
Contributor

@liuzhe-lz liuzhe-lz Nov 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No param, it was another docstring format


Parameters
----------
x: numpy array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space

@@ -52,32 +64,33 @@ def acq_max(f_acq, gp, y_max, bounds, space, num_warmup, num_starting_points):
A function to find the maximum of the acquisition function

It uses a combination of random sampling (cheap) and the 'L-BFGS-B'
optimization method. First by sampling `n_warmup` (1e5) points at random,
and then running L-BFGS-B from `n_iter` (250) random starting points.
optimization method. First by sampling `num_warmup` points at random,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if single quote works here

return None

@staticmethod
def _ucb(x, gp, kappa):
"""
Upper Confidence Bound(UCB) utility function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have a space before (

@suiguoxin suiguoxin changed the base branch from master to v1.0 November 9, 2019 02:22
@suiguoxin suiguoxin changed the base branch from v1.0 to master November 9, 2019 02:23
@suiguoxin suiguoxin closed this Nov 9, 2019
@suiguoxin suiguoxin reopened this Nov 9, 2019
@QuanluZhang QuanluZhang closed this Nov 9, 2019
@QuanluZhang QuanluZhang reopened this Nov 9, 2019
@suiguoxin suiguoxin merged commit 751445d into microsoft:master Nov 11, 2019
@suiguoxin suiguoxin deleted the docstr branch November 11, 2019 09:06
@suiguoxin suiguoxin restored the docstr branch November 13, 2019 06:14
@suiguoxin suiguoxin deleted the docstr branch November 13, 2019 06:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants