-
Notifications
You must be signed in to change notification settings - Fork 7
/
plt_hist.py
31 lines (21 loc) · 968 Bytes
/
plt_hist.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
31
import numpy as np
import matplotlib.pyplot as plt
ll_indist = -np.load('./array/indist_nll.npy')
ll_ood = -np.load('./array/ood_nll.npy')
min_ll = min(ll_indist.min(), ll_ood.min())
max_ll = max(ll_indist.max(), ll_ood.max())
bins_ll = np.linspace(min_ll, max_ll, 50)
plt.hist(ll_indist, bins_ll, alpha=0.5, label='In-distribution')
plt.hist(ll_ood, bins_ll, alpha=0.5, label='OOD')
plt.legend(loc='upper right')
plt.show()
##############################################################################################
regret_indist = np.load('./array/indist_regret.npy')
regret_ood = np.load('./array/ood_regret.npy')
min_regret = min(regret_indist.min(), regret_ood.min())
max_regret = max(regret_indist.max(), regret_ood.max())
bins_regret = np.linspace(min_regret, max_regret, 50)
plt.hist(regret_indist, bins_regret, alpha=0.5, label='In-distribution')
plt.hist(regret_ood, bins_regret, alpha=0.5, label='OOD')
plt.legend(loc='upper right')
plt.show()