-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotter.py
103 lines (84 loc) · 2.68 KB
/
plotter.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
### First Ising Test
dataB = np.loadtxt('../Data/isingDecomp1b.dat')
dataG = np.loadtxt('../Data/isingDecomp1g.dat')
fig = plt.figure(figsize=(5,8))
ax = plt.subplot(211)
plt.plot(dataG[:,0],dataG[:,1], label='Greedy')
plt.plot(dataB[:,0], dataB[:,1], label='Brute force')
plt.yscale('log')
plt.xlabel('Number of Indices')
plt.ylabel('Compression Ratio')
plt.legend(loc="best")
ax = plt.subplot(212)
plt.plot(dataG[:,0],dataG[:,2], label='Greedy')
plt.plot(dataB[:,0], dataB[:,2], label='Brute force')
plt.yscale('log')
plt.xlabel('Number of Indices')
plt.ylabel('Time (s)')
plt.legend(loc="best")
plt.tight_layout()
plt.savefig('ising.pdf')
### Second Ising Test
dataB = np.loadtxt('../Data/isingDecomp2b.dat')
dataG = np.loadtxt('../Data/isingDecomp2g.dat')
fig = plt.figure(figsize=(5,8))
ax = plt.subplot(211)
plt.plot(dataG[:,0],dataG[:,1], label='Greedy')
plt.plot(dataB[:,0], dataB[:,1], label='Brute force')
plt.xlabel('J')
plt.ylabel('Compression Ratio')
plt.legend(loc="best")
ax = plt.subplot(212)
plt.plot(dataG[:,0],dataG[:,2], label='Greedy')
plt.plot(dataB[:,0], dataB[:,2], label='Brute force')
plt.yscale('log')
plt.xlabel('J')
plt.ylabel('Time (s)')
plt.legend(loc="best")
plt.tight_layout()
plt.savefig('isingJ.pdf')
### Ising 2D Test
dataB = np.loadtxt('../Data/isingDecomp2Db.dat')
dataG = np.loadtxt('../Data/isingDecomp2Dg.dat')
dataG2 = np.loadtxt('../Data/isingDecomp2Dg2.dat')
fig = plt.figure(figsize=(5,8))
ax = plt.subplot(211)
plt.plot(dataG[:,0],dataG[:,1], label='Greedy')
plt.plot(dataG2[:,0],dataG2[:,1], label='Greedy (Variable)')
plt.plot(dataB[:,0], dataB[:,1], label='Brute force')
plt.xlabel('J')
plt.ylabel('Compression Ratio')
plt.legend(loc="best")
ax = plt.subplot(212)
plt.plot(dataG[:,0],dataG[:,2], label='Greedy')
plt.plot(dataG2[:,0],dataG2[:,2], label='Greedy (Variable)')
plt.plot(dataB[:,0], dataB[:,2], label='Brute force')
plt.yscale('log')
plt.xlabel('J')
plt.ylabel('Time (s)')
plt.legend(loc="best")
plt.tight_layout()
plt.savefig('isingJ2D.pdf')
### Sparse Test
dataB = np.loadtxt('../Data/isingDecompSparseB.dat')
dataG = np.loadtxt('../Data/isingDecompSparseG.dat')
fig = plt.figure(figsize=(5,8))
ax = plt.subplot(211)
plt.plot(dataG[:,0],dataG[:,1], label='Greedy')
plt.plot(dataB[:,0], dataB[:,1], label='Brute force')
plt.yscale('log')
plt.xlabel('Number of Indices')
plt.ylabel('Compression Ratio')
plt.legend(loc="best")
ax = plt.subplot(212)
plt.plot(dataG[:,0],dataG[:,2], label='Greedy')
plt.plot(dataB[:,0], dataB[:,2], label='Brute force')
plt.yscale('log')
plt.xlabel('Number of Indices')
plt.ylabel('Time (s)')
plt.legend(loc="best")
plt.tight_layout()
plt.savefig('sparse.pdf')