pyFTSex/tutorial/pyFTS/developer/Sadaei et Al - ExponentialyWeightedFTS.ipynb

1073 lines
741 KiB
Plaintext
Raw Normal View History

2024-08-15 12:15:32 +04:00
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.3"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
},
"colab": {
"name": "Sadaei et Al - ExponentialyWeightedFTS.ipynb",
"provenance": [],
"include_colab_link": true
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/PYFTS/notebooks/blob/master/Sadaei%20et%20Al%20-%20ExponentialyWeightedFTS.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "lM8qQ6ut_iw6",
"colab_type": "text"
},
"source": [
"# First Order Exponentialy Weighted Fuzzy Time Series by Sadaei et al. (2013)\n",
"\n",
"H. J. Sadaei, R. Enayatifar, A. H. Abdullah, and A. Gani, “Short-term load forecasting using a hybrid model with a \n",
"refined exponentially weighted fuzzy time series and an improved harmony search,” Int. J. Electr. Power Energy Syst., vol. 62, no. from 2005, pp. 118129, 2014.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "HJgv4ar5_iw_",
"colab_type": "text"
},
"source": [
"## Environment Setup"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "eoko3gLq_ixC",
"colab_type": "text"
},
"source": [
"### Library install/update"
]
},
{
"cell_type": "code",
"metadata": {
"id": "hVxSF07M_ixE",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 211
},
"outputId": "1e00bf2c-1daa-4389-d72d-6e1b17ca317d"
},
"source": [
"!pip3 install -U git+https://github.com/PYFTS/pyFTS"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting git+https://github.com/PYFTS/pyFTS\n",
" Cloning https://github.com/PYFTS/pyFTS to /tmp/pip-req-build-n4jrx5s1\n",
" Running command git clone -q https://github.com/PYFTS/pyFTS /tmp/pip-req-build-n4jrx5s1\n",
"Building wheels for collected packages: pyFTS\n",
" Building wheel for pyFTS (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for pyFTS: filename=pyFTS-1.6-cp36-none-any.whl size=197025 sha256=d833e69f2afc243355ca38841ce4f8568c09022c9ab779f1a15b1e62b9225841\n",
" Stored in directory: /tmp/pip-ephem-wheel-cache-e_w61r7a/wheels/e7/32/a9/230470113df5a73242a5a6d05671cb646db97abf14bbce2644\n",
"Successfully built pyFTS\n",
"Installing collected packages: pyFTS\n",
"Successfully installed pyFTS-1.6\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "I7IiQVlM_ixN",
"colab_type": "text"
},
"source": [
"### External libraries import"
]
},
{
"cell_type": "code",
"metadata": {
"id": "SlHwZLh4_ixQ",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "cf0537a4-0cb9-4ad1-9044-a86cf93ebe03"
},
"source": [
"import warnings\n",
"warnings.filterwarnings('ignore')\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pylab as plt\n",
"import seaborn as sns\n",
"\n",
"%pylab inline"
],
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "NBXP-XrZ_ixW",
"colab_type": "text"
},
"source": [
"### Common pyFTS imports "
]
},
{
"cell_type": "code",
"metadata": {
"id": "t9pMQ1zi_ixZ",
"colab_type": "code",
"colab": {}
},
"source": [
"from pyFTS.common import Util as cUtil\n",
"from pyFTS.benchmarks import benchmarks as bchmk, Util as bUtil\n",
"from pyFTS.partitioners import Util as pUtil\n",
"\n",
"from pyFTS.models import sadaei\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "wd5jfo-V_ixd",
"colab_type": "text"
},
"source": [
"## Common data transformations"
]
},
{
"cell_type": "code",
"metadata": {
"id": "sJhW5IqG_ixf",
"colab_type": "code",
"colab": {}
},
"source": [
"from pyFTS.common import Transformations\n",
"\n",
"tdiff = Transformations.Differential(1)\n",
"\n",
"boxcox = Transformations.BoxCox(0)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "kRyTrAxH_ixl",
"colab_type": "text"
},
"source": [
"## Datasets"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Cq94YDtt_ixp",
"colab_type": "text"
},
"source": [
"### Data Loading"
]
},
{
"cell_type": "code",
"metadata": {
"id": "Kz-5aDEk_ixq",
"colab_type": "code",
"colab": {}
},
"source": [
"from pyFTS.data import TAIEX, NASDAQ, SP500\n",
"\n",
"dataset_names = [\"TAIEX\", \"SP500\",\"NASDAQ\"]\n",
"\n",
"def get_dataset(name):\n",
" if dataset_name == \"TAIEX\":\n",
" return TAIEX.get_data()\n",
" elif dataset_name == \"SP500\":\n",
" return SP500.get_data()[11500:16000]\n",
" elif dataset_name == \"NASDAQ\":\n",
" return NASDAQ.get_data()\n",
"\n",
"\n",
"train_split = 2000\n",
"test_length = 200"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "3LrIaNnW_ixv",
"colab_type": "text"
},
"source": [
"### Visualization"
]
},
{
"cell_type": "code",
"metadata": {
"id": "_-Zl3wfq_ixw",
"colab_type": "code",
"colab": {},
"outputId": "07943492-9272-4f97-b1d4-d9f7b21d3e3b"
},
"source": [
"fig, ax = plt.subplots(nrows=2, ncols=3, figsize=[10,5])\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
" dataset_diff = tdiff.apply(dataset)\n",
"\n",
" ax[0][count].plot(dataset)\n",
" ax[1][count].plot(dataset_diff)\n",
" ax[0][count].set_title(dataset_name)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmoAAAE/CAYAAAD2ee+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzsnXd4FOX2x79n0yD0EjoYCAEEpIug\nFBGkesUuVvSiXK+9XQV7F7tiwWvB8ruKoGIF6V167yWE0EsIEEhC6p7fH/PO7ruzs32TnV3ez/Pk\nYeadsrMhM3PeU76HmBkKhUKhUCgUCuthi/QFKBQKhUKhUCjMUYaaQqFQKBQKhUVRhppCoVAoFAqF\nRVGGmkKhUCgUCoVFUYaaQqFQKBQKhUVRhppCoVAoFAqFRVGGmkKhUCgUCoVFUYZalEJEedKPnYjO\nSuu3SPvdQURMRDcajr+UiA5I6wuIqNBw3j/Etn8Q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Sj/1sW0WIohUKhCBo1b1CcK7zw+xbH\n8sFTZ3HLF8uROmYadh0947Jfed8TPg01Zl4E4IRheDiAb8TyN9B0nvTxb1ljOYCaQhdqEIDZzHyC\nmU8CmA1gsKwZJbwG30rnshxxtuCdfXbpP9JyLkOFQqHwA2bGij3a66Bzs5p+HSM6cmwSHThWi7Gw\nRWUUivJg7raj+EZyqmw+mIu/M3IAAJe/t8hl31MFmnd5YNv65XItweao1RdJzwBwBIB+dY0B7Jf2\n0zWgvI0HpBlFRKuJaHV2dvDerWAJwU6DbHCr+ai1eX36NkxcsifSl6FQWI4pq/djxGfLAQA3Xdgs\nkEP7iTB/N7Eez
"text/plain": [
"<matplotlib.figure.Figure at 0x7f0b8afeaa58>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jkywresy_ix2",
"colab_type": "text"
},
"source": [
"### Statistics"
]
},
{
"cell_type": "code",
"metadata": {
"id": "JoAd_qlg_ix2",
"colab_type": "code",
"colab": {},
"outputId": "d1144315-b01b-4bae-dec3-e79cf4e8bcb3"
},
"source": [
"from statsmodels.tsa.stattools import adfuller\n",
"\n",
"rows =[]\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" row = [dataset_name]\n",
" dataset = get_dataset(dataset_name)\n",
" result = adfuller(dataset)\n",
" row.extend([result[0],result[1]])\n",
" row.extend([value for key, value in result[4].items()])\n",
" rows.append(row)\n",
" \n",
"pd.DataFrame(rows,columns=['Dataset','ADF Statistic','p-value','Cr. Val. 1%','Cr. Val. 5%','Cr. Val. 10%'])\n"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Dataset</th>\n",
" <th>ADF Statistic</th>\n",
" <th>p-value</th>\n",
" <th>Cr. Val. 1%</th>\n",
" <th>Cr. Val. 5%</th>\n",
" <th>Cr. Val. 10%</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>TAIEX</td>\n",
" <td>-2.656728</td>\n",
" <td>0.081830</td>\n",
" <td>-3.431601</td>\n",
" <td>-2.862093</td>\n",
" <td>-2.567064</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>SP500</td>\n",
" <td>-1.747171</td>\n",
" <td>0.406987</td>\n",
" <td>-3.431811</td>\n",
" <td>-2.862186</td>\n",
" <td>-2.567114</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>NASDAQ</td>\n",
" <td>0.476224</td>\n",
" <td>0.984132</td>\n",
" <td>-3.432022</td>\n",
" <td>-2.862279</td>\n",
" <td>-2.567163</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Dataset ADF Statistic p-value Cr. Val. 1% Cr. Val. 5% Cr. Val. 10%\n",
"0 TAIEX -2.656728 0.081830 -3.431601 -2.862093 -2.567064\n",
"1 SP500 -1.747171 0.406987 -3.431811 -2.862186 -2.567114\n",
"2 NASDAQ 0.476224 0.984132 -3.432022 -2.862279 -2.567163"
]
},
"metadata": {
"tags": []
},
"execution_count": 7
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "kehPNFlF_ix7",
"colab_type": "text"
},
"source": [
"## Partitioning\n",
"\n",
"The best number of partitions of the Universe of Discourse is an optimization problem. The know more about partitioning schemes please look on the Partitioners notebook. To know more about benchmarking look on the Benchmarks notebook."
]
},
{
"cell_type": "code",
"metadata": {
"id": "ZTR4x0PF_ix9",
"colab_type": "code",
"colab": {}
},
"source": [
"from pyFTS.partitioners import Grid, Util as pUtil\n",
"from pyFTS.benchmarks import benchmarks as bchmk\n",
"from pyFTS.models import chen\n",
"\n",
"tag = 'chen_partitioning'\n",
"_type = 'point'\n",
"\n",
"for dataset_name in dataset_names:\n",
" dataset = get_dataset(dataset_name)\n",
"\n",
" bchmk.sliding_window_benchmarks(dataset, 1000, train=0.8, inc=0.2,\n",
" methods=[chen.ConventionalFTS],\n",
" benchmark_models=False,\n",
" transformations=[None],\n",
" orders=[2,3],\n",
" partitions=np.arange(10,100,2), \n",
" progress=False, type=_type,\n",
" file=\"benchmarks.db\", dataset=dataset_name, tag=tag)\n",
"\n",
" bchmk.sliding_window_benchmarks(dataset, 1000, train=0.8, inc=0.2,\n",
" methods=[chen.ConventionalFTS],\n",
" benchmark_models=False,\n",
" transformations=[tdiff],\n",
" orders=[2,3],\n",
" partitions=np.arange(3,30,1), \n",
" progress=False, type=_type,\n",
" file=\"benchmarks.db\", dataset=dataset_name, tag=tag)\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "oDiV1KtT_iyD",
"colab_type": "code",
"colab": {}
},
"source": [
"from pyFTS.benchmarks import Util as bUtil\n",
"\n",
"df1 = bUtil.get_dataframe_from_bd(\"benchmarks.db\",\n",
" \"tag = 'chen_partitioning' and measure = 'rmse'and transformation is null\")\n",
"\n",
"df2 = bUtil.get_dataframe_from_bd(\"benchmarks.db\",\n",
" \"tag = 'chen_partitioning' and measure = 'rmse' and transformation is not null\")\n",
"\n",
"fig, ax = plt.subplots(nrows=2, ncols=1, figsize=[15,7])\n",
"\n",
"g1 = sns.boxplot(x='Partitions', y='Value', hue='Dataset', data=df1, showfliers=False, ax=ax[0], \n",
" palette=\"Set3\")\n",
"box = g1.get_position()\n",
"g1.set_position([box.x0, box.y0, box.width * 0.85, box.height]) \n",
"g1.legend(loc='right', bbox_to_anchor=(1.15, 0.5), ncol=1)\n",
"ax[0].set_title(\"Original data\")\n",
"ax[0].set_ylabel(\"RMSE\")\n",
"ax[0].set_xlabel(\"\")\n",
"\n",
"g2 = sns.boxplot(x='Partitions', y='Value', hue='Dataset', data=df2, showfliers=False, ax=ax[1], \n",
" palette=\"Set3\")\n",
"box = g2.get_position()\n",
"g2.set_position([box.x0, box.y0, box.width * 0.85, box.height]) \n",
"g2.legend(loc='right', bbox_to_anchor=(1.15, 0.5), ncol=1)\n",
"ax[1].set_title(\"Differentiated data\")\n",
"ax[1].set_ylabel(\"RMSE\")\n",
"ax[1].set_xlabel(\"Number of partitions of the UoD\")"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "PtJli61J_iyH",
"colab_type": "text"
},
"source": [
"### Comparing the partitioning schemas"
]
},
{
"cell_type": "code",
"metadata": {
"id": "04QAgOWu_iyI",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 367
},
"outputId": "9920ecf6-1c9e-4145-90f6-0d653c32f805"
},
"source": [
"from pyFTS.partitioners import Grid, Util as pUtil\n",
"\n",
"fig, ax = plt.subplots(nrows=2, ncols=3, figsize=[20,5])\n",
"\n",
"\n",
"partitioners = {}\n",
"partitioners_diff = {}\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
"\n",
" partitioner = Grid.GridPartitioner(data=dataset, npart=30)\n",
" partitioners[dataset_name] = partitioner\n",
" partitioner_diff = Grid.GridPartitioner(data=dataset, npart=10, transformation=tdiff)\n",
" partitioners_diff[dataset_name] = partitioner_diff\n",
"\n",
" pUtil.plot_sets(dataset, [partitioner.sets], titles=[dataset_name], axis=ax[0][count])\n",
" pUtil.plot_sets(dataset, [partitioner_diff.sets], titles=[''], axis=ax[1][count])"
],
"execution_count": 6,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABIQAAAFKCAYAAABsCIRVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGx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eXWq5+4rIlhG6++Wbcddddl+vj\nvby8vE6tCCGfudzf4TTI+wkvLy8vtbyfYPJ+wsvLy0stVz/hkTEvLy8vLy8vLy8vLy8vLy+vq0w+\nIeTl5eXl5eXl5eXl5eXl5eV1lcknhLy8vLy8vLy8vLy8vLy8vLyuMvmEkJeXl5eXl5eXl5eXl5eX\nl9dVJp8Q8vLy8vLy8vLy8vLy8vLy8rrK5BNCXl5eXl5eXl5eXl5eXl5eXleZrAkhQsivEEKeIIR8\nTPM6IYS8mhByPyHkbwkhX3jyX9PLy8vL67TK+wkvLy8vL5O8n/Dy8vI6nXLpEHodgOcbXv9aALfn\n/74TwC889a/l5eXl5XUF6XXwfsLLy8vLS6/XwfsJLy8vr1Mna0KIUnongInhkG8A8HrK9AEA24SQ\na0/qCz4ZUUoRp5n9wCQCKDUekmYp0iy1fh6NY+vHpYn9O2VZiszl8xx+X5IkDp+XgFLze1FKEWdm\nOwFA5PD7kCZAZj4uoxnizG5PGkXWY7I0A7V8d5plyFKzzQGAOvy+NE2RWX4fpRmyzP63iSzvAwBJ\nmiGz/W2yjNndojh1sHkcg9p+X0aROZyfaeLweWkGarlGsyxD6vD3yzL7+RJn1Pp5aUaRuIwvV5Gu\nRD8BOI5ZrtdPFlvPHcBx3Mqo/boGu4Zsn+nqL1zGLvbdHL4/pUgcvn/scH0DYL7aIhdfDTD7u9gs\ndbBZlqbW8RBw8
"text/plain": [
"<Figure size 1440x360 with 6 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jwC6e5az_iyN",
"colab_type": "text"
},
"source": [
"## Fitting models"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "tfMzI8g0_iyO",
"colab_type": "text"
},
"source": [
"### With original data"
]
},
{
"cell_type": "code",
"metadata": {
"id": "W0mDBSuR_iyP",
"colab_type": "code",
"colab": {}
},
"source": [
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
"\n",
" model1 = sadaei.ExponentialyWeightedFTS(partitioner=partitioners[dataset_name])\n",
" model1.name=dataset_name\n",
" model1.fit(dataset[:train_split], save_model=True, file_path='model1'+dataset_name, order=1)\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "0-d2nsVl_iyU",
"colab_type": "text"
},
"source": [
"### With transformed data"
]
},
{
"cell_type": "code",
"metadata": {
"id": "AX2iqUZx_iyW",
"colab_type": "code",
"colab": {}
},
"source": [
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
"\n",
" model2 = sadaei.ExponentialyWeightedFTS(partitioner=partitioners_diff[dataset_name])\n",
" model2.name=dataset_name\n",
" model2.append_transformation(tdiff)\n",
" model2.fit(dataset[:train_split], save_model=True, file_path='model2'+dataset_name, order=1)\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "rrFyhOHi_iya",
"colab_type": "text"
},
"source": [
"## Predicting with the models"
]
},
{
"cell_type": "code",
"metadata": {
"id": "8z3s0TQX_iyb",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 749
},
"outputId": "eef31864-3ce1-49c8-f1eb-eb0f0b6a64c2"
},
"source": [
"fig, ax = plt.subplots(nrows=3, ncols=1, figsize=[20,10])\n",
"\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
" \n",
" ax[count].plot(dataset[train_split:train_split+200])\n",
"\n",
" model1 = cUtil.load_obj('model1'+dataset_name)\n",
"\n",
" forecasts = model1.predict(dataset[train_split:train_split+200])\n",
" \n",
" ax[count].plot(forecasts)\n",
" \n",
" ax[count].set_title(dataset_name)\n",
" \n",
"plt.tight_layout()"
],
"execution_count": 9,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEg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lg/Hz9jyu\nsfx9PLlqZDwvLdxGVmEZcWEBR/T5Yl0eO/aU8eC1wzDGdaUxDjehdyQ3jEtg5uIMqmoddAnxIzTA\nh44BPnQM8CY0wIfwIB+igv1aLIYTgRLMIiIiIiIiIiIiclRVNQ6emLeJPtEduGhojEvGnDa6KzO+\n384bSzJ46Lx+h2yz1vLiwm0kRgRydr9olxzvWO6f1IftBaV8nJpDadWRpTIiO/iy/KEzWzyO9sw0\nVFDb3ZKSkmxKSoq7wxARERERERERETnpbHl5OonZH+PhYXDlXGKHBYvFwxw6rsVZksMYgwvX9WuU\nI7KkFsr9owm4f0PrBtJGGGNWWGuTGuqnGcwiIiIiIiIiIiJyBIfDEp6zgHTvHnQfMwVcWK5iZ3EF\n763IYkKvCAbFhv7U/lFqDkWlVVw3tiseHq27fNzRzi7At0OrxtAeKcEsIiIiIiIiIiIiR1i9aTND\nKSa7zx2YiQ+6dOxoa5mfs5iPdtXwzbXj8fAwrM7ayz3zFvO7c/vgdVp3lx5PWk7rfgwgIiIiIiIi\nIiIi7ULq8kUA9Bw0xuVjG2O4YVw3tu8uZeHmAgBeXLiNYD8vrhoZ7/LjSctRgllEREREREREREQO\nUVlTS1H6SgD8Y
"text/plain": [
"<Figure size 1440x720 with 3 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "QvQ00WtC_iyi",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 143
},
"outputId": "b2a91c40-df47-4004-9003-c21b61e28300"
},
"source": [
"from pyFTS.benchmarks import Measures\n",
"\n",
"rows = []\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" row = [dataset_name]\n",
" \n",
" dataset = get_dataset(dataset_name)\n",
" \n",
" test = dataset[train_split:train_split+200]\n",
"\n",
" model1 = cUtil.load_obj('model1'+dataset_name)\n",
" \n",
" row.extend(Measures.get_point_statistics(test, model1))\n",
" \n",
" rows.append(row)\n",
" \n",
" \n",
"pd.DataFrame(rows,columns=[\"Dataset\",\"RMSE\",\"SMAPE\",\"Theil's U\"])\n",
" \n",
" \n",
" "
],
"execution_count": 10,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Dataset</th>\n",
" <th>RMSE</th>\n",
" <th>SMAPE</th>\n",
" <th>Theil's U</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>TAIEX</td>\n",
" <td>92.41</td>\n",
" <td>1.58</td>\n",
" <td>1.41</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>SP500</td>\n",
" <td>18.38</td>\n",
" <td>1.37</td>\n",
" <td>3.30</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>NASDAQ</td>\n",
" <td>48.72</td>\n",
" <td>2.35</td>\n",
" <td>2.03</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Dataset RMSE SMAPE Theil's U\n",
"0 TAIEX 92.41 1.58 1.41\n",
"1 SP500 18.38 1.37 3.30\n",
"2 NASDAQ 48.72 2.35 2.03"
]
},
"metadata": {
"tags": []
},
"execution_count": 10
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "SQ2DArZF_iyn",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 749
},
"outputId": "7aff627b-b18f-48d9-d024-3a6a51f8a01e"
},
"source": [
"fig, ax = plt.subplots(nrows=3, ncols=1, figsize=[20,10])\n",
"\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
" \n",
" ax[count].plot(dataset[train_split:train_split+200])\n",
"\n",
" model1 = cUtil.load_obj('model2'+dataset_name)\n",
"\n",
" forecasts = model1.predict(dataset[train_split:train_split+200])\n",
" \n",
" ax[count].plot(forecasts)\n",
" \n",
" ax[count].set_title(dataset_name)\n",
" \n",
"plt.tight_layout()"
],
"execution_count": 11,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd0VNXexvHvTm+EJBBqQm/SS2gC\ngmChqNiwoYCK2LF79dWr13ZVLFhQpKkUEVFEOgjSQUqoCb0klFCSEAikJzP7/WPiFRUlhIQJ5Pms\ndVZmzuyz93OyxDX5zZ69jbUWEREREREREREREZFz5eHuACIiIiIiIiIiIiJycVKBWURERERERERE\nREQKRQVmERERERERERERESkUFZhFREREREREREREpFBUYBYRERERERERERGRQlGBWURERERERERE\nREQKRQVmERERERERERERESkUFZhFRERERP7EGJN22uE0xmSe9rzvae0GGGOsMeb2P13fxRhz8LTn\ni40xWX/qd0b+a9cbY44YY8JOa9/bGJNgjCl7Ie5XRERERKSwVGAWEREREfkTa23QbwewH7j+tHPf\nnNa0P5AC9CtAt4+d3q+19vr8sWYAC4GhAMaYEGA48LC1NrUo70tEREREpKh5uTuAiIiIiMjFyBhT\nHegM9AG+M8ZUstYeKWR3g4GtxphrgTuAJdba6UUUVURERESk2KjALCIiIiJSOP2AaGvtFGPMNqAv\n8EFhOrLWJhtjngC+ASzQsOhiioiIiIgUHy2RISIiIiJSOP2AifmPJ3L2ZTI+McacOO1440+vrwLK\nAj9ba5OKOKuIiIiISLFQgVlERERE5BwZYzoANYFJ+acmAk2MMc3/4bLB1tqQ045//+n1kcA4oKcx\npn3RpxYRERERKXpaIkNERERE5Nz1Bwyw0Rjz5/Mbz7UzY8z9QCRwHRANjDbGtLDW5hRBVhERERGR\nYqMZzCIiIiIi58AY4wfcBgwCmp92PA7cZYw5p0kcxpgqwHvAA9babOAL4BjwUlHmFhEREREpDiow\ni4iIiIicmxuBTGCctfbIbwfwJa5vCHb/m+uGGWPSTjvW5Z//HJhkrV0GYK21wAPAk8aYRsV7KyIi\nIiIi58e43r+KiIiIiIiIiIiIiJwbzWAWERERERERERERkUJRgVlERERERERERERECkUFZhERERER\nEREREREpFBWYRURERERERERERKRQvNwd4GzKly9va9So4e4YIiIiIiIiIiIiIqXGunXrkq214Wdr\nV+ILzDVq1CA6OtrdMURERERERERERERKDWPMvoK00xIZIiIiIiIiIiIiIlIoKjCLiIiIiIiIiIiI\nSKGowCwiIiIiIiIiIiIihVKgArMxJt4YE2OM2WiMif7Ta88YY6wxpnz+c2OM+cQYs9sYs9kY0/K0\ntv2NMbvyj/5FeysiIiIiIiIiIiIiciGdyyZ/V1prk08/YYyJBK4B9p92ugdQN/9oCwwH2hpjwoBX\ngSjAAuuMMdOttcfPI7+IiIiIiIiIiIiIuMn5LpExFHgeV8H4N72BcdZlFRBijKkMXAvMt9am5BeV\n5wPdz3N8EREREREREREREXGTghaYLfCzMWadMWYQgDGmN5Bgrd30p7ZVgQOnPT+Yf+7vzv+FMWaQ\nMSbaGBOdlJRUwIgiIiIiIiIiIiJSWjmclhmbDjF88R6S07LdHafUKOgSGR2ttQnGmArAfGPMduD/\ncC2PUeSstSOBkQBRUVH2LM1FRERERERERESklMp1OPlpQwKfL95DXHI6AB//spO72lTnwc61qBjs\n5+aEl7YCFZittQn5PxONMVOBzkBNYJMxBiACWG+MaQMkAJGnXR6Rfy4B6PKn84vPL76IiIiIiIiI\niIi4w96kNA4cz+TwiUwOpWZxJDWTw6lZHM/I4faoSPq2rY6Hhym28bPzHExZl8Dw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FLTDrNygiIiIiIiIiIiJn\ndngTjOgMP7/MiYpt6Zo1BK/Oz5y9uAxQoQHcNw+6v4P3gZV8cuwh2mWvZMq6gwUaeszyOA4fPcyS\nRjN57cij+J2Mh96fwf3zz724DHDtf6F8fT71H0Hcvn18unD3ufchf6ECs4iIiIiIiIiIiJzZT49A\nRjL2tvHcl/0MOUER3N+pZsGv9/CEdg/DI7/iUa4Gb/hNYOzyPTid/7yqwqmsXOb+uo5lAc9Tfe8k\nTOsH4PFoaHE3eBSypOkTALeOwS83lfHlx/Hpwp2siUspXF/yPyowi4iIiIiIiIiIyF+lJ8PRWGgz\niHnO1qw/kMoz19Qr0PIWfxFaA9PpWSo4k6hyfDWLdyb+Y/NvVu/nxry5lHGehIELoOcQ11rP56tS\nE7j6dRqlreTxMkt4ctIGUjNyz7/fUkwFZhEREREREREREfmrfSsAyKvWgXfn7qBexSBuaRlR+P4a\n9MIGlGOA7xLGLI/722ZZuQ7GLtvJPT5LMHWvhaqtCj/mmbR9COpczROOsZRN283/TY2hpO9TV5IV\n4uMGERERERERERERueTFLwfvAL5NKE9c8k6+HBB1fpvieflimt1J51XDeW73XrYdbshllYP/0mzK\n+oO0ylhBWZ8T0Pr+87iBv2EM3Dgcj+GX843vCNrHVODuMTlUDPYjNMCH0ABvQgJ8CA3woXyQD21r\nlSv6DJcQFZhFRERERERERETkr+KXkxfRlo8WxtOuVhhX1q9w/n227Ifnr8O4w2c5X61oxJBbm/3h\n5TyHkxFL9vJZ4GJsYHVM7W7nP+aZBIXDTcMJm3AL4yNn8FrGvcQnZ3A8I4eMHMf/mlUu68evLxZT\nhkuECswiIiIiIiIiIiLyR+nJkLiVX6t14Vh6Dl/2uAxjzPn3G14fItsxIHEpHTZex/PdG1A+yPd/\nL8+KOYzP8Z008
"text/plain": [
"<Figure size 1440x720 with 3 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "8_8RAsX4_iyr",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 143
},
"outputId": "cc8e54e1-963d-4725-e456-cb0fa18ec097"
},
"source": [
"from pyFTS.benchmarks import Measures\n",
"\n",
"rows = []\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" row = [dataset_name]\n",
" \n",
" dataset = get_dataset(dataset_name)\n",
" \n",
" test = dataset[train_split:train_split+200]\n",
"\n",
" model1 = cUtil.load_obj('model2'+dataset_name)\n",
" \n",
" row.extend(Measures.get_point_statistics(test, model1))\n",
" \n",
" rows.append(row)\n",
" \n",
" \n",
"pd.DataFrame(rows,columns=[\"Dataset\",\"RMSE\",\"SMAPE\",\"Theil's U\"])\n",
" \n",
" \n",
" "
],
"execution_count": 12,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Dataset</th>\n",
" <th>RMSE</th>\n",
" <th>SMAPE</th>\n",
" <th>Theil's U</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>TAIEX</td>\n",
" <td>68.71</td>\n",
" <td>1.17</td>\n",
" <td>1.05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>SP500</td>\n",
" <td>5.27</td>\n",
" <td>0.39</td>\n",
" <td>0.95</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>NASDAQ</td>\n",
" <td>25.80</td>\n",
" <td>1.24</td>\n",
" <td>1.08</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Dataset RMSE SMAPE Theil's U\n",
"0 TAIEX 68.71 1.17 1.05\n",
"1 SP500 5.27 0.39 0.95\n",
"2 NASDAQ 25.80 1.24 1.08"
]
},
"metadata": {
"tags": []
},
"execution_count": 12
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jQvzck1V_iyv",
"colab_type": "text"
},
"source": [
"## Residual Analysis"
]
},
{
"cell_type": "code",
"metadata": {
"id": "Pi_N3H4d_iyw",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "69866ed3-b356-484b-a94b-a9b01647b249"
},
"source": [
"from pyFTS.benchmarks import ResidualAnalysis as ra\n",
"\n",
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
" \n",
" model1 = cUtil.load_obj('model1'+dataset_name)\n",
" model1 = cUtil.load_obj('model2'+dataset_name)\n",
"\n",
" ra.plot_residuals_by_model(dataset, [model1, model2])"
],
"execution_count": 14,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAI4CAYAAACGHoanAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3XmYFNX1//H3h11AQQRcEBwR1KBx\ny8Q1JrjFJRo0i9GAW9RxjSbuil/FBWOMexQEI4o6cfkZjcQlCihB4wpGiaARREBABWRTUdnO74+q\nhpqe7p6eme6uXs7refqZrlvVVWema7pO33vrXpkZzjnnnHOVqEXcATjnnHPOxcUTIeecc85VLE+E\nnHPOOVexPBFyzjnnXMXyRMg555xzFcsTIeecc85VLE+ECkjSVEn906zrL2lujo4zQdIpudiXKw+S\nZkk6sImv3VfS/3Idk6sv02eEcwCShkh6sImvPVHSyxnWPyvphFTbSvpSUu+mHLeRMRb8+uWJUBrh\nhePr8M3/VN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418KxIBwnAPea2Zyw5uxTC+4QvIPgb34LQV+KzwiqfZO/4QwBRodV0Eeb2Tjg/4C/\nEXwL34agwyBhNfdBBO/pp8B0gg6AANcCk4ApwH+Bt8KyrJnZJODUMPYlBOfniWk2vwD4NUH/t7uB\n5DsJ6/xeScdZGf4OhxKcf8OA483s/cbE67JyCDA1/N+9DTjGzL4Om7aGAv8O36M9CTrKP0DQTP4R\n8A3hlyszmxo+f5jgvPwSWEBw8UynoXPE5dexBH1g5gNPAFeGny8JTwK/IvhfPw74mZmtMrNpBP2z\nXiX43Pou8O+kf
"text/plain": [
"<Figure size 576x576 with 8 Axes>"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAI4CAYAAACC61aaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3XecVNX9//HXm6YCoiKIICIW0GBD\nJZYkKnYkKpoYFVGxRGJLNDG/BKPf2EJijCUmlojRqBELxoYRC6CIGhsaY0FULChIsyAoSv38/jhn\n4O4wszsLM3Nndj7Px2MeO7fMvZ/duTvnM+ece47MDOecc865WtIs7QCcc84558rNEyDnnHPO1RxP\ngJxzzjlXczwBcs4551zN8QTIOeecczXHEyDnnHPO1RxPgEpE0huS+ubZ1lfStCKdZ7ykHxfjWK5p\nkfSBpH1X8bW7S3qr2DG5ldX3WeFckqQLJN22iq89XtLT9Wx/WNLgXPtK+lLSZqty3kbGWNbyzBMg\nlhcUX8c3eaakmyW1XZ1jmtnWZja+SCG6Eoj/bJ9LWqMRrzFJW5QyrjRk/15m9pSZbZlmTE1FrkQ0\nWcAU8lkhqXt8j1qUMFRXAlnly6xilC+lYGYHmtkteba1NbP3AGL8v1vV8xTj71Gs/wdPg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8i+LvcCDhOrwW\nOM7MJjcmXleQfsAb8X/4KuAoM/s6NmENA56J79GuhA7w/yQ0i78PfEP8cmVmb8TndxKuyy+B2YTC\nMp+GrhFXHgMJfVw+Bu4Dzo+fMxkPAEcS/uePBX5gZovNbBKhH9azhM+vbYFnso79PKHc+oRwPR1u\nZtlNow25EegVr
"text/plain": [
"<Figure size 576x576 with 8 Axes>"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAI4CAYAAACGHoanAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xe4VNXZ9/HvD7BhQwQbSlHQBBNb\nsCQ2rKBRicZGUNGoxJaYJz5JNPiqUbE8mmqLGImoKBIrUYyikdgLdsGGIgiC0gQBC+V+/1hrYM6c\nmXPmHGZmz5l9f65rrjN77T177pnZZ/Y9a629lswM55xzzrk0apV0AM4555xzSfFEyDnnnHOp5YmQ\nc84551LLEyHnnHPOpZYnQs4555xLLU+EnHPOOZdanghVkKQJknoXWNdb0rQSPc84SaeUYl+uNkj6\nSNL+zXzsnpLeLXVMrr6GviOcA5B0kaTbm/nYEyU93cD6hyUNzLetpIWStmzO8zYxxoqfvzwRKiCe\nOL6MH/5MSbdIWmdV9mlm25rZuBKF6Eoo/vPNk7RGEx5jkrqXM64k5L4uM3vKzLZJMqZakS8hzT7h\nFPMdIalr/IzalDFUV0I555NPS3E+KQczO8jMhhdYt46ZfQgQ47+0uc9TivejlP8Hngg17FAzWwfY\nAdgROC/heFwZSOoK7AkYcFiiwTQi3z+9nxBdKfnxVDaZ88lOQC/g/NwNFKTlvNzo+1EpaXnDV4mZ\nzQQeISRESFpD0tWSpsZs9m+S1orrOkh6UNLnkuZKeipzY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4h/K8fDxxhZkvMbCKhf9ZzhO+t7wLP5Oz7BcJ5\najbhODrSzHKbS
"text/plain": [
"<Figure size 576x576 with 8 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "X0uI3zPT_iy0",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "FfkE8noZ_iy3",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}