MCPcopy Create free account
hub / github.com/dblalock/bolt / encoding_fig

Function encoding_fig

experiments/python/figs.py:71–207  ·  view source on GitHub ↗
(fake_data=False)

Source from the content-addressed store, hash-verified

69
70
71def encoding_fig(fake_data=False):
72 # sb.set_context("talk", rc={"figure.figsize": (6, 6)})
73 sb.set_context("talk", rc={"figure.figsize": (7, 7)})
74 # sb.set_context("talk", rc={"figure.figsize": (8, 8)})
75 # sb.set_context("talk", rc={"figure.figsize": (9, 9)})
76
77 # fig, axes = plt.subplots(3, 1)
78 fig, axes = plt.subplots(3, 2)
79
80 # ALGOS = ['Bolt', 'PQ', 'OPQ', 'PairQ']
81 ALGOS = ['Bolt', 'PQ', 'OPQ']
82 algo2offset = {'Bolt': 100, 'PQ': 50, 'OPQ': 30, 'PairQ': 25}
83 lengths = [64, 128, 256, 512, 1024]
84 # results_for_algos_lengths =
85
86 # sb.set_palette("Set1", n_colors=len(ALGOS))
87 set_palette(ncolors=len(ALGOS))
88
89 if fake_data:
90 data = np.random.randn(1, len(lengths), len(algo2offset))
91 for i, algo in enumerate(ALGOS):
92 data[:, :, i] += algo2offset[algo]
93 data /= np.arange(len(lengths)).reshape((1, -1, 1))
94
95 # ------------------------ data encoding
96
97 # 8B encodings
98 ax = axes[0, 0]
99 # sb.tsplot(data=data, condition=condition, time=lengths, ax=ax)
100 sb.tsplot(data=data, condition=None, time=lengths, ax=ax)
101 # ax.set_title(prefix + ' Encoding Speed, 8B codes')
102 ax.set_title('Data Encoding Speed', y=1.02)
103
104 # 16B encodings
105 data /= 2
106 ax = axes[1, 0]
107 sb.tsplot(data=data, condition=None, time=lengths, ax=ax)
108
109 # 32B encodings
110 data /= 2
111 ax = axes[2, 0]
112 sb.tsplot(data=data, condition=None, time=lengths, ax=ax)
113
114 # ------------------------ query encoding
115 data *= 8
116 data += np.random.randn(*data.shape) * 5
117
118 # 8B encodings
119 ax = axes[0, 1]
120 sb.tsplot(data=data, condition=None, time=lengths, ax=ax)
121 # ax.set_title(prefix + ' Encoding Speed')
122 ax.set_title('Query Encoding Speed', y=1.03, fontsize=16)
123
124 # 16B encodings
125 data /= 2
126 ax = axes[1, 1]
127 sb.tsplot(data=data, condition=None, time=lengths, ax=ax)
128

Callers

nothing calls this directly

Calls 3

set_paletteFunction · 0.85
save_figFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected