Skip to content

Commit 32bea17

Browse files
committed
refactoring
1 parent 20a00ab commit 32bea17

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

stock_prediction_deep_learning.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,23 @@ def train_LSTM_network(start_date, ticker, validation_date):
8181
print("prediction is finished")
8282

8383

84+
# The Main function requires 3 major variables
85+
# Ticker => defines the short code of a stock
86+
# Start date => Date when we want to start using the data for training, usually the first data point of the stock
87+
# Validation date => Date when we want to start partitioning our data from training to validation
8488
if __name__ == '__main__':
85-
STOCK_START_DATE = pd.to_datetime('2004-08-01')
89+
8690
STOCK_TICKER = 'GOOG'
91+
STOCK_START_DATE = pd.to_datetime('2004-08-01')
92+
STOCK_VALIDATION_DATE = pd.to_datetime('2017-01-01')
8793
EPOCHS = 100
8894
BATCH_SIZE = 32
8995
TIME_STEPS = 60
90-
token = secrets.token_hex(16)
91-
project_folder = os.path.join(os.getcwd(), token)
96+
TOKEN = secrets.token_hex(16)
97+
# create project run folder
98+
project_folder = os.path.join(os.getcwd(), TOKEN)
9299
if not os.path.exists(project_folder):
93100
os.makedirs(project_folder)
94-
stock_validation_date = pd.to_datetime('2017-01-01')
95-
train_LSTM_network(STOCK_START_DATE, STOCK_TICKER, stock_validation_date)
101+
102+
# Execute Deep Learning model
103+
train_LSTM_network(STOCK_START_DATE, STOCK_TICKER, STOCK_VALIDATION_DATE)

0 commit comments

Comments
 (0)