8cec62160ffd56f90c781f7524f643b95896c455,server/website/website/tasks/async_tasks.py,,configuration_recommendation_ddpg,#Any#,423
Before Change
conf_map_res["status"] = "good"
conf_map_res["result_id"] = result_id
conf_map_res["recommendation"] = conf_map
conf_map_res["info"] = "INFO: ddpg"
return conf_map_res
After Change
LOG.info("Use ddpg to recommend configuration")
result_id = result_info["newest_result_id"]
result_list = Result.objects.filter(pk=result_id)
result = result_list.first()
session = result.session
agg_data = DataUtil.aggregate_data(result_list)
metric_data, _ = clean_metric_data(agg_data["y_matrix"], agg_data["y_columnlabels"], session)
metric_data = metric_data.flatten()
metric_scalar = MinMaxScaler().fit(metric_data.reshape(1, -1))
normalized_metric_data = metric_scalar.transform(metric_data.reshape(1, -1))[0]
cleaned_knob_data = clean_knob_data(agg_data["X_matrix"], agg_data["X_columnlabels"],
session)
knob_labels = np.array(cleaned_knob_data[1]).flatten()
knob_num = len(knob_labels)
metric_num = len(metric_data)
ddpg = DDPG(n_actions=knob_num, n_states=metric_num, a_hidden_sizes=ACTOR_HIDDEN_SIZES,
c_hidden_sizes=CRITIC_HIDDEN_SIZES, use_default=USE_DEFAULT)
if session.ddpg_actor_model is not None and session.ddpg_critic_model is not None:
ddpg.set_model(session.ddpg_actor_model, session.ddpg_critic_model)
if session.ddpg_reply_memory is not None:
ddpg.replay_memory.set(session.ddpg_reply_memory)
knob_data = ddpg.choose_action(normalized_metric_data)
knob_bounds = np.vstack(DataUtil.get_knob_bounds(knob_labels, session))
knob_data = MinMaxScaler().fit(knob_bounds).inverse_transform(knob_data.reshape(1, -1))[0]
conf_map = {k: knob_data[i] for i, k in enumerate(knob_labels)}
conf_map_res = create_and_save_recommendation(recommended_knobs=conf_map, result=result,
status="good", info="INFO: ddpg")
return conf_map_res
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: cmu-db/ottertune
Commit Name: 8cec62160ffd56f90c781f7524f643b95896c455
Time: 2020-01-08
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/tasks/async_tasks.py
Class Name:
Method Name: configuration_recommendation_ddpg
Project Name: sahana/eden
Commit Name: ef2c9d1e1c83223c279faa8e2b1fe2df5219c7f9
Time: 2019-08-18
Author: fran@aidiq.com
File Name: modules/s3db/dc.py
Class Name: DataCollectionTemplateModel
Method Name: dc_question_onaccept
Project Name: OpenMined/Grid
Commit Name: 0bce5765b02513a167e454f112a61bd70d47d6ff
Time: 2020-03-02
Author: ionesiojr@gmail.com
File Name: gateway/app/main/processes/controller.py
Class Name: FLController
Method Name: last_participation