feature(Models): Implemented a basic Neural Network with Pytorch-Lightning (#101)

* feat: Added base functions for Neural Net.

* feat: Added function to handle Neural Nets.

* fix: Fixed fit loop

* feat: Neural Net trains now, need to test it.

* feat: Prediction now works on the neural net.

* fix: Put back config and run_pipeline.py

* fix: Took out import from run_pipeline.

* fix(Models): added get_name(), adjusted pytorch model output size

* fix(Tests): fixed tests

Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
This commit is contained in:
Daniel Szemerey
2022-01-05 12:25:03 +01:00
committed by GitHub
co-authored by Mark Aron Szulyovszky
parent 1cd0119589
commit ee35332f58
12 changed files with 197 additions and 25 deletions
+7 -1
View File
@@ -30,6 +30,8 @@ def walk_forward_train_test(
if model.only_column is not None:
X = X[[column for column in X.columns if model.only_column in column]]
is_scaling_on = scaler is not None and model.data_scaling == 'scaled'
if is_scaling_on:
@@ -58,9 +60,13 @@ def walk_forward_train_test(
X_slice = scaler.transform(X_slice.values)
else:
X_slice = X_slice.to_numpy()
current_model = model.clone()
current_model.initialize_network(input_dim = len(X_slice[0]), output_dim=1)
current_model.fit(X_slice, y_slice.to_numpy())
iterations_before_retrain = retrain_every
else:
current_model = models[index-1]