-
Notifications
You must be signed in to change notification settings - Fork 15
/
run_apq.py
28 lines (24 loc) · 836 Bytes
/
run_apq.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
from vecs_io import *
from aq import AQ
from pqx import PQX
from run_pq import execute
from run_pq import parse_args
if __name__ == '__main__':
dataset = 'netflix'
topk = 20
codebook = 8
Ks = 256
metric = 'product'
# override default parameters with command line parameters
import sys
if len(sys.argv) > 3:
dataset, topk, codebook, Ks, metric = parse_args()
else:
import warnings
warnings.warn("Using Default Parameters ")
print("# Parameters: dataset = {}, topK = {}, codebook = {}, Ks = {}, metric = {}"
.format(dataset, topk, codebook, Ks, metric))
X, T, Q, G = loader(dataset, topk, metric, folder='data/')
# pq, rq, or component of norm-pq
quantizer = PQX([AQ(codebook//2, Ks) for _ in range(2)])
execute(quantizer, X, T, Q, G, metric)