-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomize_split_recommend.py
43 lines (39 loc) · 1.37 KB
/
randomize_split_recommend.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
import argparse
from src.jobs.generate import run_generation
from src.jobs.split_generated import run as run_split
from src.jobs.recs import run as run_recs
from utils.collect_results import run as run_collect
def run(args):
for eph_phi in [0.125, 0.25, 0.5, 1, 2, 4, 8]:
args = {
'dataset': args['dataset'],
'dataset_name': args['dataset'],
'dataset_type': 'train',
'type': 'train',
'eps_phi': eph_phi,
'randomizer': 'randomized',
'base_seed': args['base_seed'],
'score_type': args['score_type'],
'generations': args['generations'],
'seed': args['seed']
}
# generate randomized datasets
run_generation(args)
# apply train-validation splitting on the generated datasets
run_split(args)
# compute recommendations on the randomized datasets
run_recs(args)
# collect the recommendation results in a unique folder
run_collect(args)
if __name__ == '__main__':
# user defined arguments
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', required=True)
parser.add_argument('--score_type', default='jaccard')
arguments = parser.parse_args()
# fixed arguments
arguments.generations = 500
arguments.base_seed = 0
arguments.seed = 0
# run script
run(vars(arguments))