From 493b45fa00bce3685dbdf81f5b30809d861b5d05 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Wed, 30 Mar 2022 23:25:41 +0200 Subject: [PATCH] tft notebook --- tft/tft.ipynb | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 tft/tft.ipynb diff --git a/tft/tft.ipynb b/tft/tft.ipynb new file mode 100644 index 0000000..d809ad7 --- /dev/null +++ b/tft/tft.ipynb @@ -0,0 +1,89 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "8c4e3b09", + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a30ae052", + "metadata": {}, + "outputs": [], + "source": [ + "from estimator import TFTEstimator\n", + "from gluonts.dataset.repository.datasets import get_dataset" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "0f3eb07d", + "metadata": {}, + "outputs": [], + "source": [ + "dataset = get_dataset(\"electricity\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3efd0fbe", + "metadata": {}, + "outputs": [], + "source": [ + "estimator = TFTEstimator(\n", + " freq=dataset.metadata.freq,\n", + " prediction_length=dataset.metadata.prediction_length,\n", + "\n", + " \n", + "\n", + " batch_size=128,\n", + " num_batches_per_epoch=100,\n", + " trainer_kwargs=dict(max_epochs=10, accelerator='auto'),\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4c1a4f83", + "metadata": {}, + "outputs": [], + "source": [ + "predictor = estimator.train(\n", + " training_data=dataset.train,\n", + " num_workers=16,\n", + " shuffle_buffer_length=1024\n", + ")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}