in sagemaker/source/visualization/model_visualisation_utils.py [0:0]
def get_dfs_from_hpt(summaries, metrics):
'''
Helper function to get a list of dataframes from a HyperparameterTuningJobAnalytics summary
Parameters:
-----------
summaries: {}
Output of training_job_summaries() of the HyperparameterTuningJobAnalytics object
metrics: [str]
A list of names of the metrics (e.g., "test_auc")
Returns:
--------
res: [(str, pd.DataFrame)]
A list of dataframe where str is the jobname and pd.DataFrame is the correponding data.
'''
res = []
for summary in summaries:
job_name = summary["TrainingJobName"]
job_df = pd.DataFrame()
for m in metrics:
df = TrainingJobAnalytics(job_name, [m], period=TIME_PERIOD).dataframe()
df.rename(columns={'value':'{}'.format(m)}, inplace=True)
if len(df) == 0:
continue
del df["metric_name"]
timestamp = df["timestamp"]
del df["timestamp"]
# Ensure that there are at least 500 epochs
job_df = pd.concat([job_df, df], 1)
job_df["timestamp"] = timestamp/60
res.append((job_name, job_df))
return res