399da723c59cc862d4d40a7eb1e6d7792208de17,pfnopt/storages/rdb.py,RDBStorage,set_trial_param,#RDBStorage#Any#Any#Any#,248
Before Change
// type: (int, str, float) -> None
session = self.scoped_session()
trial = session.query(TrialModel).filter(TrialModel.trial_id == trial_id).one()
param_distribution = session.query(TrialParamDistributionModel). \
filter(TrialParamDistributionModel.trial_id == trial.trial_id). \
filter(TrialParamDistributionModel.param_name == param_name).one()
// check if the parameter already exists
trial_param = session.query(TrialParamModel). \
filter(TrialParamModel.trial_id == trial_id). \
filter(TrialParamModel.param_distribution.has(param_name=param_name)).one_or_none()
if trial_param is not None:
assert trial_param.param_value == param_value
return
trial_param = TrialParamModel()
trial_param.trial_id = trial_id
trial_param.param_distribution_id = param_distribution.param_distribution_id
trial_param.param_value = param_value
session.add(trial_param)
After Change
def set_trial_param(self, trial_id, param_name, param_value):
// type: (int, str, float) -> None
session = self.scoped_session()
trial = models.TrialModel.find_by_id(trial_id, session, allow_none=False)
param_distribution = models.TrialParamDistributionModel.find_by_trial_and_param_name(
trial, param_name, session, allow_none=False)
// check if the parameter already exists
param = models.TrialParamModel.find_by_trial_and_param_name(trial, param_name, session)
if param is not None:
assert param.param_value == param_value
return
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 18
Instances
Project Name: pfnet/optuna
Commit Name: 399da723c59cc862d4d40a7eb1e6d7792208de17
Time: 2018-04-24
Author: sano@preferred.jp
File Name: pfnopt/storages/rdb.py
Class Name: RDBStorage
Method Name: set_trial_param
Project Name: pfnet/optuna
Commit Name: 399da723c59cc862d4d40a7eb1e6d7792208de17
Time: 2018-04-24
Author: sano@preferred.jp
File Name: pfnopt/storages/rdb.py
Class Name: RDBStorage
Method Name: set_trial_param
Project Name: pfnet/optuna
Commit Name: 399da723c59cc862d4d40a7eb1e6d7792208de17
Time: 2018-04-24
Author: sano@preferred.jp
File Name: pfnopt/storages/rdb.py
Class Name: RDBStorage
Method Name: set_study_user_attr
Project Name: pfnet/optuna
Commit Name: 399da723c59cc862d4d40a7eb1e6d7792208de17
Time: 2018-04-24
Author: sano@preferred.jp
File Name: pfnopt/storages/rdb.py
Class Name: RDBStorage
Method Name: set_trial_intermediate_value