Commit ae7a72bc authored by Hongarc's avatar Hongarc Committed by Chi Song
Browse files

Remove all whitespace at end of line (#1162)

parent 14c1b31c
...@@ -34,7 +34,7 @@ log_level_map = { ...@@ -34,7 +34,7 @@ log_level_map = {
} }
_time_format = '%m/%d/%Y, %I:%M:%S %p' _time_format = '%m/%d/%Y, %I:%M:%S %p'
class _LoggerFileWrapper(TextIOBase): class _LoggerFileWrapper(TextIOBase):
def __init__(self, logger_file): def __init__(self, logger_file):
self.file = logger_file self.file = logger_file
......
...@@ -67,7 +67,7 @@ class CurvefittingAssessor(Assessor): ...@@ -67,7 +67,7 @@ class CurvefittingAssessor(Assessor):
def trial_end(self, trial_job_id, success): def trial_end(self, trial_job_id, success):
"""update the best performance of completed trial job """update the best performance of completed trial job
Parameters Parameters
---------- ----------
trial_job_id: int trial_job_id: int
...@@ -112,7 +112,7 @@ class CurvefittingAssessor(Assessor): ...@@ -112,7 +112,7 @@ class CurvefittingAssessor(Assessor):
curr_step = len(trial_history) curr_step = len(trial_history)
if curr_step < self.start_step: if curr_step < self.start_step:
return AssessResult.Good return AssessResult.Good
if trial_job_id in self.last_judgment_num.keys() and curr_step - self.last_judgment_num[trial_job_id] < self.gap: if trial_job_id in self.last_judgment_num.keys() and curr_step - self.last_judgment_num[trial_job_id] < self.gap:
return AssessResult.Good return AssessResult.Good
self.last_judgment_num[trial_job_id] = curr_step self.last_judgment_num[trial_job_id] = curr_step
......
...@@ -26,7 +26,7 @@ curve_combination_models = ['vap', 'pow3', 'linear', 'logx_linear', 'dr_hill_zer ...@@ -26,7 +26,7 @@ curve_combination_models = ['vap', 'pow3', 'linear', 'logx_linear', 'dr_hill_zer
def vap(x, a, b, c): def vap(x, a, b, c):
"""Vapor pressure model """Vapor pressure model
Parameters Parameters
---------- ----------
x: int x: int
...@@ -109,7 +109,7 @@ model_para_num['logx_linear'] = 2 ...@@ -109,7 +109,7 @@ model_para_num['logx_linear'] = 2
def dr_hill_zero_background(x, theta, eta, kappa): def dr_hill_zero_background(x, theta, eta, kappa):
"""dr hill zero background """dr hill zero background
Parameters Parameters
---------- ----------
x: int x: int
...@@ -261,7 +261,7 @@ model_para_num['weibull'] = 4 ...@@ -261,7 +261,7 @@ model_para_num['weibull'] = 4
def janoschek(x, a, beta, k, delta): def janoschek(x, a, beta, k, delta):
"""http://www.pisces-conservation.com/growthhelp/janoschek.htm """http://www.pisces-conservation.com/growthhelp/janoschek.htm
Parameters Parameters
---------- ----------
x: int x: int
......
...@@ -35,7 +35,7 @@ logger = logging.getLogger('curvefitting_Assessor') ...@@ -35,7 +35,7 @@ logger = logging.getLogger('curvefitting_Assessor')
class CurveModel(object): class CurveModel(object):
"""Build a Curve Model to predict the performance """Build a Curve Model to predict the performance
Algorithm: https://github.com/Microsoft/nni/blob/master/src/sdk/pynni/nni/curvefitting_assessor/README.md Algorithm: https://github.com/Microsoft/nni/blob/master/src/sdk/pynni/nni/curvefitting_assessor/README.md
Parameters Parameters
...@@ -53,7 +53,7 @@ class CurveModel(object): ...@@ -53,7 +53,7 @@ class CurveModel(object):
def fit_theta(self): def fit_theta(self):
"""use least squares to fit all default curves parameter seperately """use least squares to fit all default curves parameter seperately
Returns Returns
------- -------
None None
...@@ -87,7 +87,7 @@ class CurveModel(object): ...@@ -87,7 +87,7 @@ class CurveModel(object):
def filter_curve(self): def filter_curve(self):
"""filter the poor performing curve """filter the poor performing curve
Returns Returns
------- -------
None None
...@@ -117,7 +117,7 @@ class CurveModel(object): ...@@ -117,7 +117,7 @@ class CurveModel(object):
def predict_y(self, model, pos): def predict_y(self, model, pos):
"""return the predict y of 'model' when epoch = pos """return the predict y of 'model' when epoch = pos
Parameters Parameters
---------- ----------
model: string model: string
...@@ -162,7 +162,7 @@ class CurveModel(object): ...@@ -162,7 +162,7 @@ class CurveModel(object):
def normalize_weight(self, samples): def normalize_weight(self, samples):
"""normalize weight """normalize weight
Parameters Parameters
---------- ----------
samples: list samples: list
...@@ -184,7 +184,7 @@ class CurveModel(object): ...@@ -184,7 +184,7 @@ class CurveModel(object):
def sigma_sq(self, sample): def sigma_sq(self, sample):
"""returns the value of sigma square, given the weight's sample """returns the value of sigma square, given the weight's sample
Parameters Parameters
---------- ----------
sample: list sample: list
...@@ -203,7 +203,7 @@ class CurveModel(object): ...@@ -203,7 +203,7 @@ class CurveModel(object):
def normal_distribution(self, pos, sample): def normal_distribution(self, pos, sample):
"""returns the value of normal distribution, given the weight's sample and target position """returns the value of normal distribution, given the weight's sample and target position
Parameters Parameters
---------- ----------
pos: int pos: int
...@@ -227,7 +227,7 @@ class CurveModel(object): ...@@ -227,7 +227,7 @@ class CurveModel(object):
---------- ----------
sample: list sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk} sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns Returns
------- -------
float float
...@@ -241,13 +241,13 @@ class CurveModel(object): ...@@ -241,13 +241,13 @@ class CurveModel(object):
def prior(self, samples): def prior(self, samples):
"""priori distribution """priori distribution
Parameters Parameters
---------- ----------
samples: list samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix, a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}} representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
Returns Returns
------- -------
float float
...@@ -264,13 +264,13 @@ class CurveModel(object): ...@@ -264,13 +264,13 @@ class CurveModel(object):
def target_distribution(self, samples): def target_distribution(self, samples):
"""posterior probability """posterior probability
Parameters Parameters
---------- ----------
samples: list samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix, a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}} representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
Returns Returns
------- -------
float float
...@@ -319,7 +319,7 @@ class CurveModel(object): ...@@ -319,7 +319,7 @@ class CurveModel(object):
def predict(self, trial_history): def predict(self, trial_history):
"""predict the value of target position """predict the value of target position
Parameters Parameters
---------- ----------
trial_history: list trial_history: list
......
...@@ -167,7 +167,7 @@ class EvolutionTuner(Tuner): ...@@ -167,7 +167,7 @@ class EvolutionTuner(Tuner):
self.space = None self.space = None
def update_search_space(self, search_space): def update_search_space(self, search_space):
"""Update search space. """Update search space.
Search_space contains the information that user pre-defined. Search_space contains the information that user pre-defined.
Parameters Parameters
...@@ -194,7 +194,7 @@ class EvolutionTuner(Tuner): ...@@ -194,7 +194,7 @@ class EvolutionTuner(Tuner):
Parameters Parameters
---------- ----------
parameter_id : int parameter_id : int
Returns Returns
------- -------
config : dict config : dict
......
...@@ -43,7 +43,7 @@ _epsilon = 1e-6 ...@@ -43,7 +43,7 @@ _epsilon = 1e-6
def create_parameter_id(): def create_parameter_id():
"""Create an id """Create an id
Returns Returns
------- -------
int int
...@@ -55,7 +55,7 @@ def create_parameter_id(): ...@@ -55,7 +55,7 @@ def create_parameter_id():
def create_bracket_parameter_id(brackets_id, brackets_curr_decay, increased_id=-1): def create_bracket_parameter_id(brackets_id, brackets_curr_decay, increased_id=-1):
"""Create a full id for a specific bracket's hyperparameter configuration """Create a full id for a specific bracket's hyperparameter configuration
Parameters Parameters
---------- ----------
brackets_id: int brackets_id: int
...@@ -79,7 +79,7 @@ def create_bracket_parameter_id(brackets_id, brackets_curr_decay, increased_id=- ...@@ -79,7 +79,7 @@ def create_bracket_parameter_id(brackets_id, brackets_curr_decay, increased_id=-
def json2parameter(ss_spec, random_state): def json2parameter(ss_spec, random_state):
"""Randomly generate values for hyperparameters from hyperparameter space i.e., x. """Randomly generate values for hyperparameters from hyperparameter space i.e., x.
Parameters Parameters
---------- ----------
ss_spec: ss_spec:
...@@ -116,7 +116,7 @@ def json2parameter(ss_spec, random_state): ...@@ -116,7 +116,7 @@ def json2parameter(ss_spec, random_state):
class Bracket(): class Bracket():
"""A bracket in Hyperband, all the information of a bracket is managed by an instance of this class """A bracket in Hyperband, all the information of a bracket is managed by an instance of this class
Parameters Parameters
---------- ----------
s: int s: int
...@@ -132,7 +132,7 @@ class Bracket(): ...@@ -132,7 +132,7 @@ class Bracket():
optimize_mode: str optimize_mode: str
optimize mode, 'maximize' or 'minimize' optimize mode, 'maximize' or 'minimize'
""" """
def __init__(self, s, s_max, eta, R, optimize_mode): def __init__(self, s, s_max, eta, R, optimize_mode):
self.bracket_id = s self.bracket_id = s
self.s_max = s_max self.s_max = s_max
...@@ -163,7 +163,7 @@ class Bracket(): ...@@ -163,7 +163,7 @@ class Bracket():
def set_config_perf(self, i, parameter_id, seq, value): def set_config_perf(self, i, parameter_id, seq, value):
"""update trial's latest result with its sequence number, e.g., epoch number or batch number """update trial's latest result with its sequence number, e.g., epoch number or batch number
Parameters Parameters
---------- ----------
i: int i: int
...@@ -184,7 +184,7 @@ class Bracket(): ...@@ -184,7 +184,7 @@ class Bracket():
self.configs_perf[i][parameter_id] = [seq, value] self.configs_perf[i][parameter_id] = [seq, value]
else: else:
self.configs_perf[i][parameter_id] = [seq, value] self.configs_perf[i][parameter_id] = [seq, value]
def inform_trial_end(self, i): def inform_trial_end(self, i):
"""If the trial is finished and the corresponding round (i.e., i) has all its trials finished, """If the trial is finished and the corresponding round (i.e., i) has all its trials finished,
...@@ -230,7 +230,7 @@ class Bracket(): ...@@ -230,7 +230,7 @@ class Bracket():
---------- ----------
num: int num: int
the number of hyperparameter configurations the number of hyperparameter configurations
Returns Returns
------- -------
list list
...@@ -350,7 +350,7 @@ class Hyperband(MsgDispatcherBase): ...@@ -350,7 +350,7 @@ class Hyperband(MsgDispatcherBase):
def handle_update_search_space(self, data): def handle_update_search_space(self, data):
"""data: JSON object, which is search space """data: JSON object, which is search space
Parameters Parameters
---------- ----------
data: int data: int
...@@ -392,9 +392,9 @@ class Hyperband(MsgDispatcherBase): ...@@ -392,9 +392,9 @@ class Hyperband(MsgDispatcherBase):
""" """
Parameters Parameters
---------- ----------
data: data:
it is an object which has keys 'parameter_id', 'value', 'trial_job_id', 'type', 'sequence'. it is an object which has keys 'parameter_id', 'value', 'trial_job_id', 'type', 'sequence'.
Raises Raises
------ ------
ValueError ValueError
......
...@@ -21,10 +21,10 @@ from nni.assessor import Assessor, AssessResult ...@@ -21,10 +21,10 @@ from nni.assessor import Assessor, AssessResult
logger = logging.getLogger('medianstop_Assessor') logger = logging.getLogger('medianstop_Assessor')
class MedianstopAssessor(Assessor): class MedianstopAssessor(Assessor):
"""MedianstopAssessor is The median stopping rule stops a pending trial X at step S """MedianstopAssessor is The median stopping rule stops a pending trial X at step S
if the trial’s best objective value by step S is strictly worse than the median value if the trial’s best objective value by step S is strictly worse than the median value
of the running averages of all completed trials’ objectives reported up to step S of the running averages of all completed trials’ objectives reported up to step S
Parameters Parameters
---------- ----------
optimize_mode: str optimize_mode: str
...@@ -60,7 +60,7 @@ class MedianstopAssessor(Assessor): ...@@ -60,7 +60,7 @@ class MedianstopAssessor(Assessor):
def trial_end(self, trial_job_id, success): def trial_end(self, trial_job_id, success):
"""trial_end """trial_end
Parameters Parameters
---------- ----------
trial_job_id: int trial_job_id: int
...@@ -83,7 +83,7 @@ class MedianstopAssessor(Assessor): ...@@ -83,7 +83,7 @@ class MedianstopAssessor(Assessor):
def assess_trial(self, trial_job_id, trial_history): def assess_trial(self, trial_job_id, trial_history):
"""assess_trial """assess_trial
Parameters Parameters
---------- ----------
trial_job_id: int trial_job_id: int
......
...@@ -27,7 +27,7 @@ from scipy.optimize import minimize ...@@ -27,7 +27,7 @@ from scipy.optimize import minimize
import nni.metis_tuner.lib_data as lib_data import nni.metis_tuner.lib_data as lib_data
def next_hyperparameter_expected_improvement(fun_prediction, def next_hyperparameter_expected_improvement(fun_prediction,
fun_prediction_args, fun_prediction_args,
x_bounds, x_types, x_bounds, x_types,
samples_y_aggregation, samples_y_aggregation,
......
...@@ -69,7 +69,7 @@ class NetworkMorphismTuner(Tuner): ...@@ -69,7 +69,7 @@ class NetworkMorphismTuner(Tuner):
optimize_mode : str optimize_mode : str
optimize mode "minimize" or "maximize" (default: {"minimize"}) optimize mode "minimize" or "maximize" (default: {"minimize"})
path : str path : str
default mode path to save the model file (default: {"model_path"}) default mode path to save the model file (default: {"model_path"})
verbose : bool verbose : bool
verbose to print the log (default: {True}) verbose to print the log (default: {True})
beta : float beta : float
...@@ -154,7 +154,7 @@ class NetworkMorphismTuner(Tuner): ...@@ -154,7 +154,7 @@ class NetworkMorphismTuner(Tuner):
def receive_trial_result(self, parameter_id, parameters, value): def receive_trial_result(self, parameter_id, parameters, value):
""" Record an observation of the objective function. """ Record an observation of the objective function.
Parameters Parameters
---------- ----------
parameter_id : int parameter_id : int
...@@ -267,7 +267,7 @@ class NetworkMorphismTuner(Tuner): ...@@ -267,7 +267,7 @@ class NetworkMorphismTuner(Tuner):
---------- ----------
model_id : int model_id : int
model index model index
Returns Returns
------- -------
load_model : Graph load_model : Graph
...@@ -297,7 +297,7 @@ class NetworkMorphismTuner(Tuner): ...@@ -297,7 +297,7 @@ class NetworkMorphismTuner(Tuner):
---------- ----------
model_id : int model_id : int
model index model index
Returns Returns
------- -------
float float
......
...@@ -67,7 +67,7 @@ def get_next_parameter(): ...@@ -67,7 +67,7 @@ def get_next_parameter():
params_file_name = 'parameter.cfg' params_file_name = 'parameter.cfg'
else: else:
raise AssertionError('_param_index value ({}) should >=0'.format(_param_index)) raise AssertionError('_param_index value ({}) should >=0'.format(_param_index))
params_filepath = os.path.join(_sysdir, params_file_name) params_filepath = os.path.join(_sysdir, params_file_name)
if not os.path.isfile(params_filepath): if not os.path.isfile(params_filepath):
request_next_parameter() request_next_parameter()
...@@ -81,11 +81,11 @@ def get_next_parameter(): ...@@ -81,11 +81,11 @@ def get_next_parameter():
def send_metric(string): def send_metric(string):
if _nni_platform != 'local': if _nni_platform != 'local':
data = (string).encode('utf8') data = (string).encode('utf8')
assert len(data) < 1000000, 'Metric too long' assert len(data) < 1000000, 'Metric too long'
print('NNISDK_ME%s' % (data), flush=True) print('NNISDK_ME%s' % (data), flush=True)
else: else:
data = (string + '\n').encode('utf8') data = (string + '\n').encode('utf8')
assert len(data) < 1000000, 'Metric too long' assert len(data) < 1000000, 'Metric too long'
_metric_file.write(b'ME%06d%b' % (len(data), data)) _metric_file.write(b'ME%06d%b' % (len(data), data))
_metric_file.flush() _metric_file.flush()
if sys.platform == "win32": if sys.platform == "win32":
......
...@@ -24,12 +24,12 @@ import numpy as np ...@@ -24,12 +24,12 @@ import numpy as np
def get_json_content(file_path): def get_json_content(file_path):
"""Load json file content """Load json file content
Parameters Parameters
---------- ----------
file_path: file_path:
path to the file path to the file
Raises Raises
------ ------
TypeError TypeError
...@@ -43,9 +43,9 @@ def get_json_content(file_path): ...@@ -43,9 +43,9 @@ def get_json_content(file_path):
return None return None
def generate_pcs(nni_search_space_content): def generate_pcs(nni_search_space_content):
"""Generate the Parameter Configuration Space (PCS) which defines the """Generate the Parameter Configuration Space (PCS) which defines the
legal ranges of the parameters to be optimized and their default values. legal ranges of the parameters to be optimized and their default values.
Generally, the format is: Generally, the format is:
# parameter_name categorical {value_1, ..., value_N} [default value] # parameter_name categorical {value_1, ..., value_N} [default value]
# parameter_name ordinal {value_1, ..., value_N} [default value] # parameter_name ordinal {value_1, ..., value_N} [default value]
...@@ -53,14 +53,14 @@ def generate_pcs(nni_search_space_content): ...@@ -53,14 +53,14 @@ def generate_pcs(nni_search_space_content):
# parameter_name integer [min_value, max_value] [default value] log # parameter_name integer [min_value, max_value] [default value] log
# parameter_name real [min_value, max_value] [default value] # parameter_name real [min_value, max_value] [default value]
# parameter_name real [min_value, max_value] [default value] log # parameter_name real [min_value, max_value] [default value] log
Reference: https://automl.github.io/SMAC3/stable/options.html Reference: https://automl.github.io/SMAC3/stable/options.html
Parameters Parameters
---------- ----------
nni_search_space_content: search_space nni_search_space_content: search_space
The search space in this experiment in nni The search space in this experiment in nni
Returns Returns
------- -------
Parameter Configuration Space (PCS) Parameter Configuration Space (PCS)
...@@ -81,8 +81,8 @@ def generate_pcs(nni_search_space_content): ...@@ -81,8 +81,8 @@ def generate_pcs(nni_search_space_content):
if search_space[key]['_type'] == 'choice': if search_space[key]['_type'] == 'choice':
choice_len = len(search_space[key]['_value']) choice_len = len(search_space[key]['_value'])
pcs_fd.write('%s categorical {%s} [%s]\n' % ( pcs_fd.write('%s categorical {%s} [%s]\n' % (
key, key,
json.dumps(list(range(choice_len)))[1:-1], json.dumps(list(range(choice_len)))[1:-1],
json.dumps(0))) json.dumps(0)))
if key in categorical_dict: if key in categorical_dict:
raise RuntimeError('%s has already existed, please make sure search space has no duplicate key.' % key) raise RuntimeError('%s has already existed, please make sure search space has no duplicate key.' % key)
...@@ -90,19 +90,19 @@ def generate_pcs(nni_search_space_content): ...@@ -90,19 +90,19 @@ def generate_pcs(nni_search_space_content):
elif search_space[key]['_type'] == 'randint': elif search_space[key]['_type'] == 'randint':
# TODO: support lower bound in randint # TODO: support lower bound in randint
pcs_fd.write('%s integer [0, %d] [%d]\n' % ( pcs_fd.write('%s integer [0, %d] [%d]\n' % (
key, key,
search_space[key]['_value'][0], search_space[key]['_value'][0],
search_space[key]['_value'][0])) search_space[key]['_value'][0]))
elif search_space[key]['_type'] == 'uniform': elif search_space[key]['_type'] == 'uniform':
pcs_fd.write('%s real %s [%s]\n' % ( pcs_fd.write('%s real %s [%s]\n' % (
key, key,
json.dumps(search_space[key]['_value']), json.dumps(search_space[key]['_value']),
json.dumps(search_space[key]['_value'][0]))) json.dumps(search_space[key]['_value'][0])))
elif search_space[key]['_type'] == 'loguniform': elif search_space[key]['_type'] == 'loguniform':
# use np.round here to ensure that the rounded defaut value is in the range, which will be rounded in configure_space package # use np.round here to ensure that the rounded defaut value is in the range, which will be rounded in configure_space package
search_space[key]['_value'] = list(np.round(np.log(search_space[key]['_value']), 10)) search_space[key]['_value'] = list(np.round(np.log(search_space[key]['_value']), 10))
pcs_fd.write('%s real %s [%s]\n' % ( pcs_fd.write('%s real %s [%s]\n' % (
key, key,
json.dumps(search_space[key]['_value']), json.dumps(search_space[key]['_value']),
json.dumps(search_space[key]['_value'][0]))) json.dumps(search_space[key]['_value'][0])))
elif search_space[key]['_type'] == 'quniform' \ elif search_space[key]['_type'] == 'quniform' \
...@@ -122,9 +122,9 @@ def generate_pcs(nni_search_space_content): ...@@ -122,9 +122,9 @@ def generate_pcs(nni_search_space_content):
return None return None
def generate_scenario(ss_content): def generate_scenario(ss_content):
"""Generate the scenario. The scenario-object (smac.scenario.scenario.Scenario) is used to configure SMAC and """Generate the scenario. The scenario-object (smac.scenario.scenario.Scenario) is used to configure SMAC and
can be constructed either by providing an actual scenario-object, or by specifing the options in a scenario file. can be constructed either by providing an actual scenario-object, or by specifing the options in a scenario file.
Reference: https://automl.github.io/SMAC3/stable/options.html Reference: https://automl.github.io/SMAC3/stable/options.html
The format of the scenario file is one option per line: The format of the scenario file is one option per line:
...@@ -135,7 +135,7 @@ def generate_scenario(ss_content): ...@@ -135,7 +135,7 @@ def generate_scenario(ss_content):
Parameters Parameters
---------- ----------
abort_on_first_run_crash: bool abort_on_first_run_crash: bool
If true, SMAC will abort if the first run of the target algorithm crashes. Default: True, If true, SMAC will abort if the first run of the target algorithm crashes. Default: True,
because trials reported to nni tuner would always in success state because trials reported to nni tuner would always in success state
algo: function algo: function
Specifies the target algorithm call that SMAC will optimize. Interpreted as a bash-command. Specifies the target algorithm call that SMAC will optimize. Interpreted as a bash-command.
......
...@@ -64,7 +64,7 @@ class SMACTuner(Tuner): ...@@ -64,7 +64,7 @@ class SMACTuner(Tuner):
def _main_cli(self): def _main_cli(self):
"""Main function of SMAC for CLI interface """Main function of SMAC for CLI interface
Returns Returns
------- -------
instance instance
...@@ -153,7 +153,7 @@ class SMACTuner(Tuner): ...@@ -153,7 +153,7 @@ class SMACTuner(Tuner):
def receive_trial_result(self, parameter_id, parameters, value): def receive_trial_result(self, parameter_id, parameters, value):
"""receive_trial_result """receive_trial_result
Parameters Parameters
---------- ----------
parameter_id: int parameter_id: int
...@@ -162,7 +162,7 @@ class SMACTuner(Tuner): ...@@ -162,7 +162,7 @@ class SMACTuner(Tuner):
parameters parameters
value: value:
value value
Raises Raises
------ ------
RuntimeError RuntimeError
...@@ -185,7 +185,7 @@ class SMACTuner(Tuner): ...@@ -185,7 +185,7 @@ class SMACTuner(Tuner):
Also, we convert categorical: Also, we convert categorical:
categorical values in search space are changed to list of numbers before, categorical values in search space are changed to list of numbers before,
those original values will be changed back in this function those original values will be changed back in this function
Parameters Parameters
---------- ----------
challenger_dict: dict challenger_dict: dict
...@@ -211,12 +211,12 @@ class SMACTuner(Tuner): ...@@ -211,12 +211,12 @@ class SMACTuner(Tuner):
def generate_parameters(self, parameter_id): def generate_parameters(self, parameter_id):
"""generate one instance of hyperparameters """generate one instance of hyperparameters
Parameters Parameters
---------- ----------
parameter_id: int parameter_id: int
parameter id parameter id
Returns Returns
------- -------
list list
...@@ -234,12 +234,12 @@ class SMACTuner(Tuner): ...@@ -234,12 +234,12 @@ class SMACTuner(Tuner):
def generate_multiple_parameters(self, parameter_id_list): def generate_multiple_parameters(self, parameter_id_list):
"""generate mutiple instances of hyperparameters """generate mutiple instances of hyperparameters
Parameters Parameters
---------- ----------
parameter_id_list: list parameter_id_list: list
list of parameter id list of parameter id
Returns Returns
------- -------
list list
......
...@@ -32,7 +32,7 @@ from nni.multi_phase.multi_phase_dispatcher import MultiPhaseMsgDispatcher ...@@ -32,7 +32,7 @@ from nni.multi_phase.multi_phase_dispatcher import MultiPhaseMsgDispatcher
from unittest import TestCase, main from unittest import TestCase, main
class NaiveMultiPhaseTuner(MultiPhaseTuner): class NaiveMultiPhaseTuner(MultiPhaseTuner):
''' '''
supports only choices supports only choices
''' '''
def __init__(self): def __init__(self):
......
...@@ -40,7 +40,7 @@ class TrialTestCase(TestCase): ...@@ -40,7 +40,7 @@ class TrialTestCase(TestCase):
def test_get_sequence_id(self): def test_get_sequence_id(self):
self.assertEqual(nni.get_sequence_id(), 0) self.assertEqual(nni.get_sequence_id(), 0)
def test_report_intermediate_result(self): def test_report_intermediate_result(self):
nni.report_intermediate_result(123) nni.report_intermediate_result(123)
self.assertEqual(test_platform.get_last_metric(), { self.assertEqual(test_platform.get_last_metric(), {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 56px; height: 56px;
background: #0071BC; background: #0071BC;
border-right: 1px solid #ccc; border-right: 1px solid #ccc;
z-index: 1000; z-index: 1000;
......
...@@ -139,7 +139,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -139,7 +139,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
const items = metricSource[key]; const items = metricSource[key];
if (items.trialJobId === id) { if (items.trialJobId === id) {
// succeed trial, last intermediate result is final result // succeed trial, last intermediate result is final result
// final result format may be object // final result format may be object
if (typeof JSON.parse(items.data) === 'object') { if (typeof JSON.parse(items.data) === 'object') {
mediate.push(JSON.parse(items.data).default); mediate.push(JSON.parse(items.data).default);
} else { } else {
......
...@@ -78,7 +78,7 @@ class Progressed extends React.Component<ProgressProps, ProgressState> { ...@@ -78,7 +78,7 @@ class Progressed extends React.Component<ProgressProps, ProgressState> {
}).then(res => { }).then(res => {
if (res.status === 200) { if (res.status === 200) {
message.destroy(); message.destroy();
message.success(`Update ${CONTROLTYPE[1].toLocaleLowerCase()} message.success(`Update ${CONTROLTYPE[1].toLocaleLowerCase()}
successfully`); successfully`);
// rerender trial profile message // rerender trial profile message
const { updateFile } = this.props; const { updateFile } = this.props;
......
...@@ -15,7 +15,7 @@ class TrialLog extends React.Component<TrialLogProps, {}> { ...@@ -15,7 +15,7 @@ class TrialLog extends React.Component<TrialLogProps, {}> {
render() { render() {
const { logStr } = this.props; const { logStr } = this.props;
return ( return (
<div> <div>
<LogPathChild <LogPathChild
......
...@@ -49,8 +49,8 @@ table { ...@@ -49,8 +49,8 @@ table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
} }
@font-face { @font-face {
font-family: 'Segoe'; font-family: 'Segoe';
src: url('./static/font/SegoePro-Regular.ttf'); src: url('./static/font/SegoePro-Regular.ttf');
} }
...@@ -50,7 +50,7 @@ const getFinalResult = (final: Array<FinalResult>) => { ...@@ -50,7 +50,7 @@ const getFinalResult = (final: Array<FinalResult>) => {
} }
}; };
// get final result value // acc obj // get final result value // acc obj
const getFinal = (final: Array<FinalResult>) => { const getFinal = (final: Array<FinalResult>) => {
let showDefault: FinalType; let showDefault: FinalType;
if (final) { if (final) {
......
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