Skip to content

Commit 08b0942

Browse files
committed
plot fixes
1 parent 3dfaf42 commit 08b0942

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

ml_grid/results_processing/plot_timeline.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,22 @@ def _plot_single_timeline(
105105

106106
plt.figure(figsize=figsize)
107107

108+
# Convert index to datetime
109+
timeline_df.index = pd.to_datetime(timeline_df.index, errors='coerce')
110+
108111
# Plot each algorithm
109112
for algo in timeline_df.columns:
110113
algo_data = timeline_df[algo].dropna()
111114
if len(algo_data) > 0:
112-
x_positions = range(len(algo_data))
113-
plt.plot(x_positions, algo_data, marker='o', linewidth=2,
115+
plt.plot(algo_data.index, algo_data, marker='o', linewidth=2,
114116
markersize=6, label=algo)
115117

116-
plt.xlabel('Run Index (Chronological Order)', fontsize=12)
118+
plt.xlabel('Run Timestamp', fontsize=12)
117119
plt.ylabel(f'{aggregation.title()} {metric.upper()}', fontsize=12)
118120
plt.title(f'{aggregation.title()} {metric.upper()} Performance Timeline - All Outcomes',
119121
fontsize=14, fontweight='bold')
120122

121-
# Set x-tick labels to show actual timestamps (abbreviated)
122-
run_timestamps = timeline_df.index.tolist()
123-
tick_positions = range(0, len(run_timestamps), max(1, len(run_timestamps) // 10))
124-
tick_labels = [run_timestamps[i][:10] + '...' for i in tick_positions]
125-
plt.xticks(tick_positions, tick_labels, rotation=45, ha='right')
123+
plt.xticks(rotation=45, ha='right')
126124

127125
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
128126
plt.grid(True, alpha=0.3)

ml_grid/util/project_score_save.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def update_score_log(
208208
end = time.time()
209209

210210
logger.debug(f"Cross-validation scores: {scores}")
211-
line["run_time"] = int((end - start) / 60)
211+
line["run_time"] = (end - start)
212212
line["t_fits"] = pg
213213
line["n_fits"] = n_iter_v
214214
line["i"] = param_space_index # 0 # should be index of the iterator

0 commit comments

Comments
 (0)