{"cells":[{"cell_type":"code","execution_count":3,"metadata":{"id":"gQ_Hg7HN8YfS","executionInfo":{"status":"ok","timestamp":1642265686205,"user_tz":-60,"elapsed":266,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"}}},"outputs":[],"source":["import numpy as np\n","import pandas as pd\n","import os\n","%matplotlib inline\n","import warnings\n","\n","warnings.filterwarnings(\"ignore\")"]},{"cell_type":"code","execution_count":4,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":4178,"status":"ok","timestamp":1642265691910,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"},"user_tz":-60},"id":"xT41FAPfR1bV","outputId":"ca7877bc-7c91-488a-cc80-0f262a9f0b96"},"outputs":[{"output_type":"stream","name":"stdout","text":["Requirement already satisfied: pytorch-lightning==1.4.9 in /usr/local/lib/python3.7/dist-packages (1.4.9)\n","Requirement already satisfied: tqdm>=4.41.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (4.62.3)\n","Requirement already satisfied: torchmetrics>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (0.6.2)\n","Requirement already satisfied: fsspec[http]!=2021.06.0,>=2021.05.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (2022.1.0)\n","Requirement already satisfied: pyDeprecate==0.3.1 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (0.3.1)\n","Requirement already satisfied: PyYAML>=5.1 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (6.0)\n","Requirement already satisfied: numpy>=1.17.2 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (1.19.5)\n","Requirement already satisfied: future>=0.17.1 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (0.18.2)\n","Requirement already satisfied: tensorboard>=2.2.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (2.7.0)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (3.10.0.2)\n","Requirement already satisfied: packaging>=17.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (21.3)\n","Requirement already satisfied: torch>=1.6 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning==1.4.9) (1.10.0+cu111)\n","Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (2.23.0)\n","Requirement already satisfied: aiohttp in /usr/local/lib/python3.7/dist-packages (from fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (3.8.1)\n","Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=17.0->pytorch-lightning==1.4.9) (3.0.6)\n","Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (0.37.1)\n","Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (1.35.0)\n","Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (0.6.1)\n","Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (1.0.1)\n","Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (57.4.0)\n","Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (0.4.6)\n","Requirement already satisfied: protobuf>=3.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (3.17.3)\n","Requirement already satisfied: grpcio>=1.24.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (1.43.0)\n","Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (3.3.6)\n","Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (0.12.0)\n","Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning==1.4.9) (1.8.1)\n","Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py>=0.4->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (1.15.0)\n","Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (4.2.4)\n","Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (4.8)\n","Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (0.2.8)\n","Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (1.3.0)\n","Requirement already satisfied: importlib-metadata>=4.4 in /usr/local/lib/python3.7/dist-packages (from markdown>=2.6.8->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (4.10.0)\n","Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (3.7.0)\n","Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (0.4.8)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (2021.10.8)\n","Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (3.0.4)\n","Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (1.24.3)\n","Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (2.10)\n","Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning==1.4.9) (3.1.1)\n","Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (4.0.2)\n","Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (1.2.0)\n","Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (21.4.0)\n","Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (2.0.10)\n","Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (1.2.0)\n","Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (1.7.2)\n","Requirement already satisfied: asynctest==0.13.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (0.13.0)\n","Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning==1.4.9) (5.2.0)\n"]}],"source":["!pip install pytorch-lightning==1.4.9"]},{"cell_type":"code","execution_count":5,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":4378,"status":"ok","timestamp":1642265699439,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"},"user_tz":-60},"id":"NdMo2rjoA-zv","outputId":"885cb1a1-2cb9-4785-8041-f179458fd05f"},"outputs":[{"output_type":"stream","name":"stdout","text":["Requirement already satisfied: pytorch-forecasting in /usr/local/lib/python3.7/dist-packages (0.9.2)\n","Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (1.4.1)\n","Requirement already satisfied: scikit-learn<1.1,>=0.24 in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (1.0.2)\n","Requirement already satisfied: statsmodels in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (0.10.2)\n","Requirement already satisfied: pandas<2.0.0,>=1.3.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (1.3.5)\n","Requirement already satisfied: torch<2.0,>=1.7 in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (1.10.0+cu111)\n","Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (3.2.2)\n","Requirement already satisfied: optuna<3.0.0,>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (2.10.0)\n","Requirement already satisfied: pytorch-lightning<2.0.0,>=1.2.4 in /usr/local/lib/python3.7/dist-packages (from pytorch-forecasting) (1.4.9)\n","Requirement already satisfied: PyYAML in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (6.0)\n","Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (21.3)\n","Requirement already satisfied: alembic in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (1.7.5)\n","Requirement already satisfied: cliff in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (3.10.0)\n","Requirement already satisfied: sqlalchemy>=1.1.0 in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (1.4.29)\n","Requirement already satisfied: colorlog in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (6.6.0)\n","Requirement already satisfied: cmaes>=0.8.2 in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (0.8.2)\n","Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (4.62.3)\n","Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from optuna<3.0.0,>=2.3.0->pytorch-forecasting) (1.19.5)\n","Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=20.0->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (3.0.6)\n","Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.7/dist-packages (from pandas<2.0.0,>=1.3.0->pytorch-forecasting) (2018.9)\n","Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas<2.0.0,>=1.3.0->pytorch-forecasting) (2.8.2)\n","Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas<2.0.0,>=1.3.0->pytorch-forecasting) (1.15.0)\n","Requirement already satisfied: torchmetrics>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.6.2)\n","Requirement already satisfied: pyDeprecate==0.3.1 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.3.1)\n","Requirement already satisfied: future>=0.17.1 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.18.2)\n","Requirement already satisfied: fsspec[http]!=2021.06.0,>=2021.05.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (2022.1.0)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (3.10.0.2)\n","Requirement already satisfied: tensorboard>=2.2.0 in /usr/local/lib/python3.7/dist-packages (from pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (2.7.0)\n","Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (2.23.0)\n","Requirement already satisfied: aiohttp in /usr/local/lib/python3.7/dist-packages (from fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (3.8.1)\n","Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn<1.1,>=0.24->pytorch-forecasting) (1.1.0)\n","Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn<1.1,>=0.24->pytorch-forecasting) (3.0.0)\n","Requirement already satisfied: greenlet!=0.4.17 in /usr/local/lib/python3.7/dist-packages (from sqlalchemy>=1.1.0->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (1.1.2)\n","Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from sqlalchemy>=1.1.0->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (4.10.0)\n","Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (57.4.0)\n","Requirement already satisfied: grpcio>=1.24.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.43.0)\n","Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.6.1)\n","Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.0.1)\n","Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.37.1)\n","Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.35.0)\n","Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.8.1)\n","Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.12.0)\n","Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.4.6)\n","Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (3.3.6)\n","Requirement already satisfied: protobuf>=3.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (3.17.3)\n","Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (4.8)\n","Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.2.8)\n","Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (4.2.4)\n","Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.3.0)\n","Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata->sqlalchemy>=1.1.0->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (3.7.0)\n","Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.4.8)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (2021.10.8)\n","Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.24.3)\n","Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (3.0.4)\n","Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (2.10)\n","Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (3.1.1)\n","Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.2.0)\n","Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (2.0.10)\n","Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (4.0.2)\n","Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.2.0)\n","Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (5.2.0)\n","Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (21.4.0)\n","Requirement already satisfied: asynctest==0.13.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (0.13.0)\n","Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->fsspec[http]!=2021.06.0,>=2021.05.0->pytorch-lightning<2.0.0,>=1.2.4->pytorch-forecasting) (1.7.2)\n","Requirement already satisfied: importlib-resources in /usr/local/lib/python3.7/dist-packages (from alembic->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (5.4.0)\n","Requirement already satisfied: Mako in /usr/local/lib/python3.7/dist-packages (from alembic->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (1.1.6)\n","Requirement already satisfied: PrettyTable>=0.7.2 in /usr/local/lib/python3.7/dist-packages (from cliff->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (3.0.0)\n","Requirement already satisfied: cmd2>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from cliff->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (2.3.3)\n","Requirement already satisfied: stevedore>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from cliff->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (3.5.0)\n","Requirement already satisfied: autopage>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from cliff->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (0.4.0)\n","Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from cliff->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (5.8.0)\n","Requirement already satisfied: pyperclip>=1.6 in /usr/local/lib/python3.7/dist-packages (from cmd2>=1.0.0->cliff->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (1.8.2)\n","Requirement already satisfied: wcwidth>=0.1.7 in /usr/local/lib/python3.7/dist-packages (from cmd2>=1.0.0->cliff->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (0.2.5)\n","Requirement already satisfied: MarkupSafe>=0.9.2 in /usr/local/lib/python3.7/dist-packages (from Mako->alembic->optuna<3.0.0,>=2.3.0->pytorch-forecasting) (2.0.1)\n","Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pytorch-forecasting) (0.11.0)\n","Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pytorch-forecasting) (1.3.2)\n","Requirement already satisfied: patsy>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from statsmodels->pytorch-forecasting) (0.5.2)\n"]}],"source":["!pip install pytorch-forecasting"]},{"cell_type":"code","execution_count":6,"metadata":{"id":"5E8cT9kA96ot","executionInfo":{"status":"ok","timestamp":1642265708831,"user_tz":-60,"elapsed":3855,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"}}},"outputs":[],"source":["import torch\n","import torch.nn as nn\n","from torch.autograd import Variable\n","from pytorch_forecasting import TimeSeriesDataSet"]},{"cell_type":"code","execution_count":7,"metadata":{"id":"U5PZyCSaBj9e","executionInfo":{"status":"ok","timestamp":1642265714733,"user_tz":-60,"elapsed":4757,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"}}},"outputs":[],"source":["import copy\n","from pathlib import Path\n","import warnings\n","\n","import numpy as np\n","import pandas as pd\n","import pytorch_lightning as pl\n","from pytorch_lightning.callbacks import EarlyStopping, LearningRateMonitor\n","from pytorch_lightning.loggers import TensorBoardLogger\n","import torch\n","\n","from pytorch_forecasting import Baseline, TemporalFusionTransformer, TimeSeriesDataSet\n","from pytorch_forecasting.data import GroupNormalizer\n","from pytorch_forecasting.metrics import SMAPE, PoissonLoss, QuantileLoss, RMSE\n","from pytorch_forecasting.models.temporal_fusion_transformer.tuning import optimize_hyperparameters"]},{"cell_type":"code","execution_count":8,"metadata":{"id":"F2zUA7J3Re6c","executionInfo":{"status":"ok","timestamp":1642265720568,"user_tz":-60,"elapsed":235,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"}}},"outputs":[],"source":["# import pkg_resources\n","# pkg_resources.require(\"pytorch_lightning==1.4.9\")\n","# import pytorch_lightning as pl"]},{"cell_type":"code","execution_count":9,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":306,"status":"ok","timestamp":1642265721865,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"},"user_tz":-60},"id":"OOwr5s36QlhF","outputId":"a6766984-3ef2-47f8-cec4-d45e91361b90"},"outputs":[{"output_type":"stream","name":"stdout","text":["1.4.9\n"]}],"source":["print(pl.__version__)"]},{"cell_type":"code","execution_count":10,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":1700,"status":"ok","timestamp":1642265725077,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"},"user_tz":-60},"id":"wCx1hNMd8dt8","outputId":"707a3261-2993-4313-e00d-a1faec11893a"},"outputs":[{"output_type":"stream","name":"stdout","text":["Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"]}],"source":["from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"code","execution_count":11,"metadata":{"id":"h3akp80X83Pr","executionInfo":{"status":"ok","timestamp":1642265727644,"user_tz":-60,"elapsed":279,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"}}},"outputs":[],"source":["data = pd.read_csv('/content/drive/My Drive/Taxi Prediction Master/yellow_cut12k.csv')\n","# df = pd.read_csv('train/train.csv')"]},{"cell_type":"code","execution_count":12,"metadata":{"id":"pKxsuRsHBbn1","executionInfo":{"status":"ok","timestamp":1642265729709,"user_tz":-60,"elapsed":249,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"}}},"outputs":[],"source":["# data = train_df"]},{"cell_type":"code","execution_count":13,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":287},"executionInfo":{"elapsed":259,"status":"ok","timestamp":1642265731878,"user":{"displayName":"Faheem Ahmed Abbasi","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GhgtOF28sy7gFBpnhma6GfiWjvqUh1r3ss-fhJtog=s64","userId":"04247060777971177506"},"user_tz":-60},"id":"wYCEEfjiCk74","outputId":"acc8f85b-046d-4ed1-e03f-e948d97d7db9"},"outputs":[{"output_type":"execute_result","data":{"text/html":["\n","
\n"," | Unnamed: 0 | \n","VendorID | \n","tpep_pickup_datetime | \n","tpep_dropoff_datetime | \n","passenger_count | \n","trip_distance | \n","pickup_longitude | \n","pickup_latitude | \n","store_and_fwd_flag | \n","dropoff_longitude | \n","dropoff_latitude | \n","pickup_datetime | \n","demand | \n","
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n","0 | \n","2 | \n","6/9/2016 21:06 | \n","6/9/2016 21:13 | \n","2 | \n","0.79 | \n","-73.983360 | \n","40.760937 | \n","N | \n","-73.977463 | \n","40.753979 | \n","6/9/2016 21:06 | \n","1.58 | \n","
1 | \n","1 | \n","2 | \n","6/9/2016 21:06 | \n","6/9/2016 21:35 | \n","1 | \n","5.22 | \n","-73.981720 | \n","40.736668 | \n","N | \n","-73.981636 | \n","40.670242 | \n","6/9/2016 21:06 | \n","5.22 | \n","
2 | \n","2 | \n","2 | \n","6/9/2016 21:06 | \n","6/9/2016 21:13 | \n","1 | \n","1.26 | \n","-73.994316 | \n","40.751072 | \n","N | \n","-74.004234 | \n","40.742168 | \n","6/9/2016 21:06 | \n","1.26 | \n","
3 | \n","3 | \n","2 | \n","6/9/2016 21:06 | \n","6/9/2016 21:36 | \n","1 | \n","7.39 | \n","-73.982361 | \n","40.773891 | \n","N | \n","-73.929466 | \n","40.851540 | \n","6/9/2016 21:06 | \n","7.39 | \n","
4 | \n","4 | \n","2 | \n","6/9/2016 21:06 | \n","6/9/2016 21:23 | \n","1 | \n","3.10 | \n","-73.987106 | \n","40.733173 | \n","N | \n","-73.985909 | \n","40.766445 | \n","6/9/2016 21:06 | \n","3.10 | \n","