Skip to content

Commit

Permalink
inference_times_plots.py: code to plot mean time for inference of mod…
Browse files Browse the repository at this point in the history
…els from tests/results
  • Loading branch information
antoninoLorenzo committed Jul 4, 2024
1 parent 796dc7d commit 52eee2f
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions static/inference_times_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,35 @@

if __name__ == "__main__":
with open('../test/tests/results/conversion_times.json', 'r', encoding='utf-8') as fp:
data = json.load(fp)
data_conv = json.load(fp)

with open('../test/tests/results/inference_times.json', 'r', encoding='utf-8') as fp:
data_plan = json.load(fp)

inference_times_conv = [{'model': k, 'time': v['mean']} for k, v in data_conv.items()]
inference_times_plan = [{'model': k, 'time': v['mean']} for k, v in data_conv.items()]

inference_times_conv = [{'model': k, 'time': v['mean']} for k, v in data.items()]
df_conv = pd.DataFrame(inference_times_conv)
df_plan = pd.DataFrame(inference_times_plan)

plt.figure(figsize=(12, 12))
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(16, 16))
fig.suptitle('Inference Times')
sns.set(style="whitegrid")
sns.barplot(x='model', y='time', data=df_conv)
plt.xlabel('Model')
plt.ylabel('Mean Time')
plt.title('Mean Conversion Times per Model')
plt.xticks(rotation=45)

ax_plan = axes[0, 0]
sns.barplot(x='model', y='time', data=df_plan, ax=ax_plan)
ax_plan.set_title('Planning Times')
ax_plan.set_xlabel('Model')
ax_plan.set_ylabel('Time')
ax_plan.xticks(rotation=45)

ax_conv = axes[0, 1]
sns.barplot(x='model', y='time', data=df_conv, ax=ax_conv)
ax_plan.set_title('Conversion Times')
ax_plan.set_xlabel('Model')
ax_plan.set_ylabel('Time')
ax_plan.xticks(rotation=45)

plt.tight_layout()
plt.subplots_adjust(top=0.92)
plt.show()

0 comments on commit 52eee2f

Please sign in to comment.