feat(Pytorch): added custom model to pytorch-forecasting (#8)

* feat: Refractored and created new model. Pipeline not ready yet.

* feat: Implemented and refactored a data pipeline.

* ref: Refractored to make more sense.

* feat: Training works now with models that you can change.

* feat: Added predict function but without working instructions.

* feat: gitignore.
This commit is contained in:
Daniel Szemerey
2021-11-18 10:59:06 +01:00
committed by GitHub
parent 6e192ebc8a
commit d4676e099b
12 changed files with 353 additions and 18 deletions
+48
View File
@@ -0,0 +1,48 @@
from load_data import load_files
import pandas as pd
# from tensorflow import keras
from utils.normalize import normalize
# import tensorflow as tf
from utils.visualize import visualize_loss
from torch.utils.data import DataLoader, random_split
from model_lightning import LitManualAutoEncoder
import pytorch_lightning as pl
#%%
data = load_files('data/', False)
data.reset_index(drop=True, inplace=True)
data = data[[column for column in data.columns if not column.endswith('volume')]]
data.head()
#%%
ticker_to_predict = 'ETH_returns'
learning_rate = 0.002
batch_size = 64
epochs = 100
split_fraction = 0.715
train_split = int(split_fraction * int(data.shape[0]))
past = 10
future = 1
start = past + future
end = start + train_split
# train = DataLoader(train, batch_size=32)
# test = DataLoader(test, batch_size=32)
# val = DataLoader(val, batch_size=32)
# init model
ae = LitManualAutoEncoder()
# Initialize a trainer
trainer = pl.Trainer(gpus=1, max_epochs=3, progress_bar_refresh_rate=20)
# Train the model ⚡
# trainer.fit(ae, train, val)