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
+19
View File
@@ -0,0 +1,19 @@
from pytorch_forecasting import TemporalFusionTransformer
from pytorch_forecasting.metrics import QuantileLoss
def create_TemporalFusionTransformer(training_dataset, model_options):
# create the model
tft = TemporalFusionTransformer.from_dataset(
training_dataset,
learning_rate=0.03,
hidden_size=32,
attention_head_size=1,
dropout=0.1,
hidden_continuous_size=16,
output_size=7,
loss=QuantileLoss(),
log_interval=2,
reduce_on_plateau_patience=4
)
print(f"Number of parameters in network: {tft.size()/1e3:.1f}k")
return tft