-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.py
107 lines (105 loc) · 2.97 KB
/
parser.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import argparse
def parse_args():
parser = argparse.ArgumentParser(
description="Train or predict stock movement with a neural network."
)
parser.add_argument(
"-dp",
"--days-prior",
metavar="days taken into account for time series",
type=int,
nargs="*",
help="the number of days prior a single datapoint includes",
)
parser.add_argument(
"-s",
"--sequence-sep",
metavar="Seperation of prediction time and feature sequence time",
type=int,
nargs="*",
help="the number of days of seperation between the predicted value and the sequence of values used for prediction",
)
parser.add_argument(
"-e",
"--epochs",
metavar="number of epochs",
type=int,
nargs="*",
help="the number of cycles through the data during training",
)
parser.add_argument(
"-lr",
"--learning-rate",
metavar="learning rate",
type=float,
nargs="*",
help="the rate at which the model learns",
)
parser.add_argument(
"-wd",
"--weight-decay",
metavar="weight decay",
type=float,
nargs="*",
help="weight decay for L2 regularization",
)
parser.add_argument(
"-m",
"--batch-size",
metavar="batch size",
type=int,
nargs="*",
help="the number of datapoints in a batch",
)
parser.add_argument("--shuffle-dataset", action="store_true")
parser.add_argument("--predict-movement", action="store_true")
parser.add_argument("--use-pretrained", action="store_true")
parser.add_argument(
"-p",
"--val-split",
metavar="validation split",
type=float,
nargs=1,
help="the fraction of training data used for validation",
)
parser.add_argument(
"-q",
"--test-split",
metavar="test split",
type=float,
nargs=1,
help="the fraction of training data used for testing",
)
parser.add_argument(
"-nh",
"--norm-hist-length",
metavar="number of days in history used to normalize data",
type=int,
nargs="*",
help="the number of days in history used to normalize data",
)
parser.add_argument(
"-hu",
"--num-hidden-units",
metavar="number of hidden units",
type=int,
nargs="*",
help="the number of hidden units in the LSTM model",
)
parser.add_argument("--test-best", action="store_true")
parser.set_defaults(
batch_size=[64],
days_prior=[7],
sequence_sep=[0],
epochs=[50],
learning_rate=[1e-3],
weight_decay=[1e-3],
shuffle_dataset=False,
use_pretrained=False,
val_split=[0.2],
norm_hist_length=[500],
num_hidden_units=[16],
test_best=False,
predict_movement=False
)
return parser.parse_args()