-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtune.py
More file actions
61 lines (54 loc) · 1.68 KB
/
Copy pathtune.py
File metadata and controls
61 lines (54 loc) · 1.68 KB
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
"""Entry point to model tuning using K-Fold cross validation."""
from argparse import ArgumentParser, BooleanOptionalAction
from superphot_plus.file_paths import INPUT_CSVS
from superphot_plus.tuner import SuperphotTuner
def extract_cmd_args():
"""Extracts the script command-line arguments."""
parser = ArgumentParser(
description="Model tuning using K-Fold cross validation",
)
parser.add_argument(
"--input_csvs",
help="List of CSVs containing light curve data (comma separated)",
default=",".join(INPUT_CSVS),
)
parser.add_argument(
"--sampler",
help="Name of the sampler to load fits from",
choices=["dynesty", "nuts", "svi"],
default="dynesty",
)
parser.add_argument(
"--include_redshift",
help="If flag is set, include redshift data for training",
default=True,
action=BooleanOptionalAction,
)
parser.add_argument(
"--num_hp_samples",
help="Name of parameter combinations to try",
default=10,
)
parser.add_argument(
"--num_cpu",
help="Number of CPUs to use in each parallel experiment",
default=2,
)
parser.add_argument(
"--num_gpu",
help="Number of GPUs to use in each parallel experiment",
default=0,
)
return parser.parse_args()
if __name__ == "__main__":
args = extract_cmd_args()
tuner = SuperphotTuner(
sampler=args.sampler,
include_redshift=args.include_redshift,
num_cpu=args.num_cpu,
num_gpu=args.num_gpu,
)
tuner.run(
input_csvs=args.input_csvs.split(","),
num_hp_samples=int(args.num_hp_samples),
)