2024-09-16 11:39:14 +00:00
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
import functions as aux
|
|
|
|
|
2024-10-04 11:11:49 +00:00
|
|
|
model_type = 'BCNN' # BCNN or LeNet
|
|
|
|
dataset = 'MNIST' # MNIST or CIFAR
|
2024-09-16 11:39:14 +00:00
|
|
|
|
|
|
|
eff_df = aux.load_pickle("efficiency_data.pkl")
|
|
|
|
|
|
|
|
entropy_data_noise = aux.load_pickle("entropy_data_noisy.pkl")
|
|
|
|
entropy_data = aux.load_pickle("entropy_data.pkl")
|
|
|
|
|
|
|
|
bayes_keys = ['conv1.W_mu', 'conv1.W_rho', 'conv1.bias_mu', 'conv1.bias_rho',
|
|
|
|
'conv2.W_mu', 'conv2.W_rho', 'conv2.bias_mu', 'conv2.bias_rho',
|
|
|
|
'fc1.W_mu', 'fc1.W_rho', 'fc1.bias_mu', 'fc1.bias_rho',
|
|
|
|
'fc2.W_mu', 'fc2.W_rho', 'fc2.bias_mu', 'fc2.bias_rho',
|
|
|
|
'fc3.W_mu', 'fc3.W_rho', 'fc3.bias_mu', 'fc3.bias_rho']
|
|
|
|
|
|
|
|
lenet_keys = ['conv1.weight', 'conv1.bias', 'conv2.weight', 'conv2.bias',
|
|
|
|
'fc1.weight', 'fc1.bias', 'fc2.weight', 'fc2.bias', 'fc3.weight',
|
|
|
|
'fc3.bias']
|
|
|
|
|
2024-09-25 10:34:47 +00:00
|
|
|
all_noises = [0.1, 0.25, 0.5, 0.75, 0.99, 'raleigh', 'erlang', 'exponential', 'uniform', 'impulse']
|
2024-09-16 11:39:14 +00:00
|
|
|
|
|
|
|
for size in range(1, 2):
|
2024-10-04 11:11:49 +00:00
|
|
|
#plt.plot(eff_df[dataset][model_type][size],
|
|
|
|
# label='Efficiency')
|
2024-09-16 11:39:14 +00:00
|
|
|
plt.plot(entropy_data[dataset][model_type][size],
|
|
|
|
label='Entropy at noise 0.0')
|
|
|
|
|
|
|
|
for noise in all_noises:
|
|
|
|
plt.plot(entropy_data_noise[dataset][model_type][noise],
|
|
|
|
label='Entropy at noise {}'.format(noise))
|
|
|
|
|
|
|
|
plt.legend(loc='upper right')
|
|
|
|
# plt.legend(loc='lower right')
|
|
|
|
plt.show()
|