-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathplot_fishers.py
More file actions
44 lines (33 loc) · 1.58 KB
/
plot_fishers.py
File metadata and controls
44 lines (33 loc) · 1.58 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c) 2019. Vincenzo Lomonaco, Karan Desai, Eugenio Culurciello, #
# Davide Maltoni. All rights reserved. #
# See the accompanying LICENSE file for terms. #
# #
# Date: 27-05-2019 #
# Authors: Vincenzo Lomonaco, Karan Desai, Eugenio Culurciello, Davide Maltoni #
# E-mail: vincenzo.lomonaco@unibo.it #
# Website: vincenzolomonaco.com #
################################################################################
""" This simple script can be used to plot the fisher matrices. """
import pickle as pkl
import numpy as np
import matplotlib.pyplot as plt
import sys
if len(sys.argv) < 3:
print("usage: plot_results.py file.bin")
with open(sys.argv[1], 'rb') as f:
fisher = np.fromfile(f)
print("loaded.")
n_bins = 100
print(fisher)
plt.hist(fisher, bins=n_bins, range=(0, np.max(fisher) * 1.5))
print("Tot params: ", fisher.shape[0])
over = np.where(fisher >= (np.max(fisher) - np.max(fisher)/10))[0].shape[0]
print("Values greater than {}: {}".format(np.max(fisher) - np.max(fisher)/10, over))
print("Percentage (%): ", (over / fisher.shape[0]) * 100)
print("max:", np.max(fisher))
plt.yscale('log', nonposy='clip')
plt.show()
print('Showing Fisher 0...')