Skip to content

Commit 15e18cb

Browse files
committed
updated stock price prediction tutorial
1 parent 7cc58a0 commit 15e18cb

File tree

37 files changed

+11128
-12271
lines changed

37 files changed

+11128
-12271
lines changed

machine-learning/stock-prediction/data/AAPL_2020-01-08.csv renamed to machine-learning/stock-prediction/data/AAPL_2020-04-28.csv

+9,927-9,850
Large diffs are not rendered by default.

machine-learning/stock-prediction/data/TSLA_2020-01-08.csv

-2,400
This file was deleted.

machine-learning/stock-prediction/parameters.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55

66
# Window size or the sequence length
7-
N_STEPS = 100
7+
N_STEPS = 70
88
# Lookup step, 1 is the next day
9-
LOOKUP_STEP = 90
9+
LOOKUP_STEP = 1
1010

1111
# test ratio size, 0.2 is 20%
1212
TEST_SIZE = 0.2
@@ -24,17 +24,23 @@
2424
UNITS = 256
2525
# 40% dropout
2626
DROPOUT = 0.4
27+
# whether to use bidirectional RNNs
28+
BIDIRECTIONAL = False
2729

2830
### training parameters
2931

30-
# mean squared error loss
31-
LOSS = "mse"
32-
OPTIMIZER = "rmsprop"
32+
# mean absolute error loss
33+
# LOSS = "mae"
34+
# huber loss
35+
LOSS = "huber_loss"
36+
OPTIMIZER = "adam"
3337
BATCH_SIZE = 64
34-
EPOCHS = 300
38+
EPOCHS = 400
3539

3640
# Apple stock market
3741
ticker = "AAPL"
3842
ticker_data_filename = os.path.join("data", f"{ticker}_{date_now}.csv")
39-
# model name to save
40-
model_name = f"{date_now}_{ticker}-{LOSS}-{CELL.__name__}-seq-{N_STEPS}-step-{LOOKUP_STEP}-layers-{N_LAYERS}-units-{UNITS}"
43+
# model name to save, making it as unique as possible based on parameters
44+
model_name = f"{date_now}_{ticker}-{LOSS}-{OPTIMIZER}-{CELL.__name__}-seq-{N_STEPS}-step-{LOOKUP_STEP}-layers-{N_LAYERS}-units-{UNITS}"
45+
if BIDIRECTIONAL:
46+
model_name += "-b"

0 commit comments

Comments
 (0)