-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathassignment.py
54 lines (35 loc) · 1.73 KB
/
assignment.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
44
45
46
47
48
49
50
51
52
53
54
import os
import argparse
def network_one(learning_rate, epochs, batches):
print("Combination One with learning rate: {} epochs: {} and batch size: {}".format(learning_rate, epochs, batches))
def network_two(learning_rate, epochs, batches):
print("Combination Two with learning rate: {} epochs: {} and batch size: {}".format(learning_rate, epochs, batches))
def main(combination, learning_rate, epochs, batches, seed):
# Set Seed
print("Seed: {}".format(seed))
if int(combination)==1:
network_one(learning_rate, epochs, batches)
if int(combination)==2:
network_two(learning_rate, epochs, batches)
print("Done!")
def check_param_is_numeric(param, value):
try:
value = float(value)
except:
print("{} must be numeric".format(param))
quit(1)
return value
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(description="Assignment Program")
arg_parser.add_argument("combination", help="Flag to indicate which network to run")
arg_parser.add_argument("learning_rate", help="Learning Rate parameter")
arg_parser.add_argument("iterations", help="Number of iterations to perform")
arg_parser.add_argument("batches", help="Number of batches to use")
arg_parser.add_argument("seed", help="Seed to initialize the network")
args = arg_parser.parse_args()
combination = check_param_is_numeric("combination", args.combination)
learning_rate = check_param_is_numeric("learning_rate", args.learning_rate)
epochs = check_param_is_numeric("epochs", args.iterations)
batches = check_param_is_numeric("batches", args.batches)
seed = check_param_is_numeric("seed", args.seed)
main(combination, learning_rate, epochs, batches, seed)