-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_utils.py
30 lines (27 loc) · 1.4 KB
/
plot_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. #
# #
# Date: 24/07/2021 #
# Author(s): Antonio Carta #
# E-mail: contact@continualai.org #
# Website: avalanche.continualai.org #
################################################################################
import matplotlib.pyplot as plt
def learning_curves_plot(all_metrics: dict):
"""Creates a plot with separate learning curves for each experience.
:param all_metrics: Dictionary of metrics as returned by
EvaluationPlugin.get_all_metrics
:return: matplotlib figure
"""
accs_keys = list(filter(lambda x: "Top1_Acc_Exp" in x, all_metrics.keys()))
fig, ax = plt.subplots()
for ak in accs_keys:
k = ak.split("/")[-1]
x, y = all_metrics[ak]
plt.plot(x, y, label=k)
ax.legend()
ax.set_xlabel("Iterations")
ax.set_ylabel("Experience Accuracy")
return fig