-
Notifications
You must be signed in to change notification settings - Fork 2
/
arguments.py
41 lines (33 loc) · 1.87 KB
/
arguments.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
import os
import argparse
import warnings
import sys
def get_args():
parser = argparse.ArgumentParser(description='Active Learning in MOSM')
# GP model
parser.add_argument('--max_iterations', default=200, type=int, help='number of training iterations')
parser.add_argument('--n_components', default=10, type=int, help='number of spectral mixture components')
parser.add_argument('--data_file', default=None, help='pickle file to load data from')
parser.add_argument('--num_samples', default=40, type=int, help='maximum number of samples')
parser.add_argument('--heterotopic', action='store_true', help='only one measurement allowed at a location')
parser.add_argument('--utility', default='mutual_information', help='one from {mutual_information, entropy}')
parser.add_argument('--num_pretrain_samples', default=20, type=int, help='number of samples in pilot survey for model initialization')
parser.add_argument('--render', action='store_true')
parser.add_argument('--seed', default=1, type=int, help='random seed')
parser.add_argument('--id', default=1, type=int, help='unique id of every instance')
parser.add_argument('--save_dir', default='results', help='save directory')
parser.add_argument('--eval_only', action='store_true', help='will not save anything in this setting')
args = parser.parse_args()
args.save_dir = os.path.join(args.save_dir, str(args.id))
if not args.eval_only:
if os.path.exists(args.save_dir):
warnings.warn('SAVE DIRECTORY ALREADY EXISTS!')
ch = input('Press c to continue and s to stop: ')
if ch == 's':
sys.exit(0)
elif ch == 'c':
os.rename(args.save_dir, args.save_dir+'_old')
elif ch != 'c':
raise NotImplementedError
os.makedirs(args.save_dir)
return args