Skip to content

Commit

Permalink
[fixed] Now translating dots in parameter names into underscores, so …
Browse files Browse the repository at this point in the history
…that altair does not complain.
  • Loading branch information
marianokamp committed May 30, 2024
1 parent 95d7208 commit da509d7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions amtviz/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def visualize_tuning_job(
else pd.DataFrame()
)

trials_df.columns = trials_df.columns.map(_clean_parameter_name)
full_df.columns = full_df.columns.map(_clean_parameter_name)
charts = create_charts(
trials_df,
tuned_parameters,
Expand Down Expand Up @@ -531,6 +533,11 @@ def render_progress_chart():
return overview_row & detail_rows & job_level_rows


# Ensure proper parameter name characters for altair 5+
def _clean_parameter_name(s):
return s.replace(":", "_").replace(".", "_")


def _prepare_training_job_metrics(jobs):
df = pd.DataFrame()
for job_name, start_time, end_time in jobs:
Expand Down Expand Up @@ -736,4 +743,6 @@ def get_job_analytics_data(tuning_job_names):
print(f"Number of training jobs with valid objective: {len(df)}")
print(f"Lowest: {min(df[objective_name])} Highest {max(df[objective_name])}")

tuned_parameters = [_clean_parameter_name(tp) for tp in tuned_parameters]

return df, tuned_parameters, objective_name, is_minimize

0 comments on commit da509d7

Please sign in to comment.