pyFTSex/tutorial/pyFTS/developer/Song - ConventionalFTS.ipynb

1007 lines
726 KiB
Plaintext
Raw Permalink 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": "Song - ConventionalFTS.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/Song%20-%20ConventionalFTS.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "vJzk53mqEAW0",
"colab_type": "text"
},
"source": [
"# First Order Traditional Fuzzy Time Series method by Song & Chissom (1993)\n",
"\n",
"Q. Song and B. S. Chissom, “Fuzzy time series and its models,” Fuzzy Sets Syst., vol. 54, no. 3, pp. 269277, 1993."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "n5_F4UtyEAW4",
"colab_type": "text"
},
"source": [
"## Environment Setup"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MvFGutscEAW7",
"colab_type": "text"
},
"source": [
"### Library install/update"
]
},
{
"cell_type": "code",
"metadata": {
"id": "-wFbyFjmEAW9",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 211
},
"outputId": "4d0351bf-2ffe-4419-dc34-e1c14f3289f8"
},
"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-v3ka3owc\n",
" Running command git clone -q https://github.com/PYFTS/pyFTS /tmp/pip-req-build-v3ka3owc\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=05585985a4d79ef4ef3ae92b46edf4e7fbaa0cfacc1bc1c35f6e9fe1a69b8628\n",
" Stored in directory: /tmp/pip-ephem-wheel-cache-de1vqkdf/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": "O7sY9wGiEAXG",
"colab_type": "text"
},
"source": [
"### External libraries import"
]
},
{
"cell_type": "code",
"metadata": {
"id": "FjTS_QmgEAXJ",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "998f7b83-5eb2-440f-ba75-c303c6cd4554"
},
"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": "FACM8bWjEAXQ",
"colab_type": "text"
},
"source": [
"### Common pyFTS imports "
]
},
{
"cell_type": "code",
"metadata": {
"id": "XFcgU2PmEAXS",
"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 song\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "xLiqnuylEAXX",
"colab_type": "text"
},
"source": [
"## Common data transformations"
]
},
{
"cell_type": "code",
"metadata": {
"id": "GYhNkIGxEAXY",
"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": "Jnx1bOjoEAXe",
"colab_type": "text"
},
"source": [
"## Datasets"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jxCuWP20EAXg",
"colab_type": "text"
},
"source": [
"### Data Loading"
]
},
{
"cell_type": "code",
"metadata": {
"id": "2elozp_mEAXi",
"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": "kcq5Rwd7EAXn",
"colab_type": "text"
},
"source": [
"### Visualization"
]
},
{
"cell_type": "code",
"metadata": {
"id": "cKUjQwaYEAXp",
"colab_type": "code",
"colab": {},
"outputId": "0e605a2e-6310-4ffc-b939-e8ee58a290ca"
},
"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/Etn8Q0REiqi3tP5yIDhJRjYr4vgqFPxBRLyJaSkS5\nRHSCiP4mogvFfVAm/q5PE9F6IrpCHJMq7hH5b/9Z6ZxJRDRRHHeEiB41fGZ/ItpORAVENJ+Izqvo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sKwZJbwG30rnshxxtuCdfXbpP9JyLkOFQqHwA2bGij3a66Bzs5p+HSM6cmwSHThWi7Gw\nRWUUivJg7raj+EZyqmw+mIu/M3IAAJe/t8hl31MFmnd5YNv65XItweao1RdJzwBwBIB+dY0B7Jf2\n0zWgvI0HpBlFRKuJaHV2dvDerWAJwU6DbHCr+ai1eX36NkxcsifSl6FQWI4pq/djxGfLAQA3Xdgs\nkEP7iTB/N7Eez
"text/plain": [
"<matplotlib.figure.Figure at 0x7f1d9d525908>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "2vH6Rs_3EAXw",
"colab_type": "text"
},
"source": [
"### Statistics"
]
},
{
"cell_type": "code",
"metadata": {
"id": "RlymHBC_EAXy",
"colab_type": "code",
"colab": {}
},
"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": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "w2N9i_FDEAX2",
"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": "pKF_XL8AEAX3",
"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",
" 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",
" 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": "S5SYQaXYEAX9",
"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": "4uQw3zRCEAYA",
"colab_type": "text"
},
"source": [
"### Comparing the partitioning schemas"
]
},
{
"cell_type": "code",
"metadata": {
"id": "btbXowDtEAYD",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 367
},
"outputId": "cbc2daa8-6532-4f4d-878c-305bd5b3c757"
},
"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=33)\n",
" partitioners[dataset_name] = partitioner\n",
" partitioner_diff = Grid.GridPartitioner(data=dataset, npart=15, 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": 10,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABIQAAAFKCAYAAABsCIRVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzsvXu0bVlZH/ib67Gf57H3ObegqCqK\nW1WAMdqtUUQycEQ7dowaDUl8t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FhYXGdwRaELCwsLCwsLCwsLCwsLCwsLK4z2IKQhYWFhYWFhYWFhYWFhYWFxXUG\nWxCysLCwsLCwsLCwsLCwsLCwuM5gC0IWFhYWFhYWFhYWFhYWFhYW1xlsQcjCwsLCwsLCwsLCwsLC\nwsLiOkNtQYgx9huMsUuMsXs1rzPG2BsYYxcYY3/NGPuy1X9MCwsLC4vTCpsnLCwsLCxMsHnCwsLC\n4nSiiULoLQC+3vD6NwB4XvbvewD8ytE/loWFhYXFGcJbYPOEhYWFhYUeb4HNExYWFhanDrUFIc75\nBwHsGN7yEgBv5SnuBjBgjD1rVR/wMAjjBJxz85uiwPgy5xxhEprfkyTgUWR8TxIn4In5s8RRWPt5\neZSYf0+SII5j88/gMTg3vydMeO1nCWo+CzgHYvPaJTxBlJjXjkcReGL+XXFU/13HUd33yMFj889I\nkgRJzWdJkvrvMaj5GZxzhHHN+iYxEJvXLkoiJLzmdwXmcwBI19f4M5IESd1xl/D6cyCOa9cuSZqc\nszW/J+GIa96DOAJqvqew5vi+3nC95olGcSyOwWvOkbjBZ6mNY5yD18SOJnkiSSLwmtgRJPWftzZP\nJEltHIuTGHFSE
"text/plain": [
"<Figure size 1440x360 with 6 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "WRPf2Y1IEAYH",
"colab_type": "text"
},
"source": [
"## Fitting models"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cbVBost5EAYI",
"colab_type": "text"
},
"source": [
"### With original data"
]
},
{
"cell_type": "code",
"metadata": {
"id": "1KODZMNXEAYK",
"colab_type": "code",
"colab": {}
},
"source": [
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
"\n",
" model1 = song.ConventionalFTS(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": "oIqek9SDEAYO",
"colab_type": "text"
},
"source": [
"### With transformed data"
]
},
{
"cell_type": "code",
"metadata": {
"id": "fMQddS8mEAYP",
"colab_type": "code",
"colab": {}
},
"source": [
"for count,dataset_name in enumerate(dataset_names):\n",
" dataset = get_dataset(dataset_name)\n",
"\n",
" model2 = song.ConventionalFTS(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": "jXQ8iOjuEAYU",
"colab_type": "text"
},
"source": [
"## Predicting with the models"
]
},
{
"cell_type": "code",
"metadata": {
"id": "eGmCuKpREAYV",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 749
},
"outputId": "9130003c-33b7-4973-b284-6cb1f82784ec"
},
"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": 13,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd4XMXd9vF71HuXrN5s2bJxt9zo\nJRgwnVAM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NMnDHmHWPMDu9trLevMcbcZ4zZaYxZb4yZ\nPmA/C739dxhjFh6skwIAAAAAAAAAHHyDncF8r6Q3rbX5kqZI2iLpTknvWWvzJL3nfSxJZ0nK8243\nSFokScaYOEk/lTRb0ixJP90VSgMAAAAAAAAADj/7DJiNMdGSTpT0kCRZa/usta2Szpf0mLfbY5Iu\n8N4/X9Ljtt8ySTHGmBRJZ0h6x1rbbK1tkfSOpDOH9GwAAAAAAAAAAIfMYGYw50hqkPSIMWaNMeYf\nxphwSaOstTXePrWSRnnvp0mqGPD6Sm/b3tq/wBhzgzGm0BhT2NDQMPizAQAAAAAAAAAcMoMJmAMk\nTZe0yFo7TVKX/lsOQ5JkrbWS7FANylr7gLW2wFpbkJiYOFS7BQAAAAAAAAAMocEEzJWSKq21y72P\nX1B/4FznLX0h72299/kqSRkDXp/ubdtbOwAAAAAAAADgMLTPgNlaWyupwhgzztt0mqTNkhZLWuht\nWyjpFe/9xZKuNv3mSGrzltJ4S9I8Y0ysd3G/ed42AAAAAAAAAMBhKGCQ/W6R9JQxJkhSsaRr1R9O\n/9MY83VJZZIu9
"text/plain": [
"<Figure size 1440x720 with 3 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "td318onIEAYZ",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 143
},
"outputId": "4b675d99-89be-4460-d248-6d28f4ac4448"
},
"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": 14,
"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>2464.05</td>\n",
" <td>53.58</td>\n",
" <td>37.43</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>SP500</td>\n",
" <td>96.15</td>\n",
" <td>7.96</td>\n",
" <td>17.41</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>NASDAQ</td>\n",
" <td>1597.12</td>\n",
" <td>94.78</td>\n",
" <td>66.67</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Dataset RMSE SMAPE Theil's U\n",
"0 TAIEX 2464.05 53.58 37.43\n",
"1 SP500 96.15 7.96 17.41\n",
"2 NASDAQ 1597.12 94.78 66.67"
]
},
"metadata": {
"tags": []
},
"execution_count": 14
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "2LdopGFNEAYe",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 749
},
"outputId": "cd213827-7b8e-464b-a602-b7e9db6e51eb"
},
"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": 15,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd4FlXax/HvSSGhhAQIBAih9xog\n9C5FRARUQKwoKipgX111dd/dtdcFO6yIBVCxoAiIgNJ76L3XEEoI6T3Pef+YIAkE0gnl97muuZLM\nnDlzJq7uPHfuuW9jrUVEREREREREREREJK/cinsBIiIiIiIiIiIiInJlUoBZRERERERERERERPJF\nAWYRERERERERERERyRcFmEVEREREREREREQkXxRgFhEREREREREREZF8UYBZRERERERERERERPJF\nAWYRERERERERERERyRcFmEVEREREzmGMicu0uYwxiZl+vjPTuHuNMdYYc9s553c3xhzJ9PNCY0zS\nOfP+mnHsJmPMMWNM+UzjBxpjwowxvpfifkVERERE8ksBZhERERGRc1hry5zZgEPATZn2Tck0dDgQ\nCdyTi2nHZJ7XWntTxrV+Bf4E/gtgjPEDPgEesdZGF+Z9iYiIiIgUNo/iXoCIiIiIyJXIGFMD6AYM\nAb4zxlS21h7L53SPAduMMdcDw4BF1toZhbRUEREREZEiowCziIiIiEj+3AOEWmt/NMZsB+4E3s3P\nRNbaCGPM48AUwAKNC2+ZIiIiIiJFRyUyRERERETy5x5gasb3U8m5TMb7xpioTNvL5xxfCfgCc621\nJwt5rSIiIiIiRUIBZhERERGRPDLGdAJqAd9m7JoKNDPGBF/ktMestX6ZtpfOOT4B+AroZ4zpUPir\nFhEREREpfCqRISIiIiKSd8MBA2wwxpy7f0NeJzPG3A8EAf2BUOAzY0xLa21KIaxVRERERKTIKINZ\nRERERCQPjDHewFBgJBCcaXsUuMMYk6ckDmNMVeBt4EFrbTLwKXAK+EdhrltEREREpCgowCwiIiIi\nkjeDgETgK2vtsTMb8DnOG4J9L3Deh8aYuEzb2oz9HwPfWmuXAFhrLfAg8IQxpknR3oqIiIiISMEY\n5/lVRERERERERERERCRvlMEsIiIiIiIiIiIiIvmiALOIiIiIiIiIiIiI5IsCzCIiIiIiIiIiIiKS\nLwowi4iIiIiIiIiIiEi+eBT3AnLi7+9va9asWdzLEBEREREREREREblmrF27NsJaWzGncZd9gLlm\nzZqEhoYW9zJERERERERERERErhnGmIO5GacSGSIiIiIiIiIiIiKSLwowi4iIiIiIiIiIiEi+KMAs\nIiIiIiIiIiIiIvmSqwCzMeaAMWazMWaDMSb0nGNPG2OsMcY/42djjHnfGLPHGLPJGNMq09jhxpjd\nGdvwwr0VEREREREREREREbmU8tLkr4e1NiLzDmNMENAHOJRp9w1AvYytHfAJ0M4YUx74PyAEsMBa\nY8wMa+3pAqxfRERERERERERERIpJQUtk/Bd4FidgfMZA4CvrWAn4GWOqANcD86y1kRlB5XlA3wJe\nX0RERERERERERESKSW4DzBaYa4xZa4wZCWCMGQiEWWs3njM2EDic6ecjGfsutP88xpiRxphQY0zo\nyZMnc7lEERERERERERERuVa5XJb5244zdv4uDp6KL+7lXDNyWyKjs7U2zBhTCZhnjNkBvIBTHqPQ\nWWsnABMAQkJCbA7DRURERERERERE5BqVkubilw1hTFi8j90n4gB4/4/d9GtWhYe71aFpoG8xr/Dq\nlqsAs7U2LOPrCWPMdKAbUAvYaIwBqAasM8a0BcKAoEynV8vYFwZ0P2f/woItX0RERERERERERC41\nay1rDpzm4Kl4jsckcSwmiWPRzteI2BR6Na7EM9c3xLekZ5GtIS45jW9XH2Li0v2ERyfRsLIPY28L\npk2t8ny14gBTVx5i5qZwutTz5+FudehYpwIZsUwp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Zc7BZhFRERERERERETk\noiYu3c+R04n8s39jPNzzH1K8p0NNvD3dGL9430XHfbpoLy5rGd2jbt4ukJoEkRefG6Bd7Qo83ac+\nszaFM3nlwbxdQ7JQDWYRERERERERERG5oOMxSXy0YA99GgfQsa5/geYqX7oEw9pUZ8qqgzzdpz5V\nfEtme72pqw9xS6tAgsqXyt3EiadhzURY9SnEn4Sg9tD5Cah3PbhlHxB/uGsd1uyP5OWZ2ylb0pOa\nFUrjV8oTv5Il8PH2yFcjwWuRAswiIiIiIiIiIiJyQW/N2UlauuUfNzY6/2BaCsSGQ8xRiD0KMeEQ\nfwLq3wA1OmQ73/2da/H1yoNMWnaAF/qdP+eni/aS7rKM6ZGLRoLRYbDyY1j7BaTEQd1eUKMjhE6C\nb4ZBxUbQ6TFoOhg8SmQ51c3N8N7QYPp/sJTHv92Q9ZiBsiU98Svpye9PdsXLo+D1n69WCjCLiIiI\niIiIiIhItjYejuLHdUd4qFttalQoffbA4TXw/b0Qc+T8k4wbLBsHLe+CXv+B0hWyHA4qX4obm1Vh\n6qpDjO5RN0vDwBMxSUxddYhbWgZSvcJFspdP7oJlY2HTNLAuaHordHocKjd1jnd8DLZOh6Vj4edH\n4M9XoMNoaPNglkBzudIlmPNEF3YdjyUqIdXZElOJTkghKjGV2KQ0BZdzoACziIiIiIiIiIiIZGvs\n/F1UKF2CMZlrIbvSYeaTTmC3+/NQtir4VHW+lq0C7iVg0Zuw4iPYMRv6vAzBd4I5W3LioW61mbHx\nKFNWHWRU97Nzj1+8jzSXZcx1F6i9HH8KFr4OoZ+Dhxe0ud8JHPtVzzrO3ROaD4VmQ2DPfCfQ/PsL\ncHInDHg/y1Afb
"text/plain": [
"<Figure size 1440x720 with 3 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "uzEjl0cnEAYi",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 143
},
"outputId": "2222d916-2144-49ed-aeaa-6d5f19a07dea"
},
"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": 16,
"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>120.04</td>\n",
" <td>2.25</td>\n",
" <td>1.82</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>SP500</td>\n",
" <td>6.76</td>\n",
" <td>0.52</td>\n",
" <td>1.22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>NASDAQ</td>\n",
" <td>90.85</td>\n",
" <td>5.14</td>\n",
" <td>3.79</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Dataset RMSE SMAPE Theil's U\n",
"0 TAIEX 120.04 2.25 1.82\n",
"1 SP500 6.76 0.52 1.22\n",
"2 NASDAQ 90.85 5.14 3.79"
]
},
"metadata": {
"tags": []
},
"execution_count": 16
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0rCs_lQdEAYo",
"colab_type": "text"
},
"source": [
"## Residual Analysis"
]
},
{
"cell_type": "code",
"metadata": {
"id": "osgNXFz-EAYp",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "8UP_KLTwEAYr",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "67b12ff3-0da0-438a-b4c6-63a1b9723625"
},
"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": 18,
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAI4CAYAAACGHoanAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3XecVNX9//HXmy6CUi00QUUNxr5f\nS9QEY8MSS2KMhtgVCxpbNCh2QzRqbIkQMfZglF+iCVGMUSIxMWoEO9hQQEGRDiIq7fP7456Fu7Mz\ns7O7M3OnfJ6Pxzx27rl37nx25+69nznn3HNkZjjnnHPOVaMWSQfgnHPOOZcUT4Scc845V7U8EXLO\nOedc1fJEyDnnnHNVyxMh55xzzlUtT4Scc845V7U8ESoiSVMkDcywbqCkWXl6n4mSTs3HvlxlkDRD\n0n5NfO3ekt7Nd0yuvmznCOcAJF0l6Q9NfO2Jkv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5/iW27lZgPaLaqReJmuYy+T/gJUnLgHHA\nuRbGgnCcANxrZh+FmrM5Ft0h+Fuiv/ktRH0pPiOq9k39hnMVcH+ogj7azJ4BLgf+TPQtfAuiDoOE\nau79iT7TOcD7RB0AAX4BTALeAN4EXgllOTOzScBpIfZFRMfniRk2/xnwY6L+b3cBqXcS1vm9Ut5n\nRfgdDiI6/kYCx5vZO42J1+VkEDAl/O/eBhxjZl+Gpq0RwPPhM9qdqKP8g0TN5NOBrwhfrsxsSnj+\nMNFxuQyYS3TxzKShY8QV1rFEfWA+AR4Drgznl1p/BX5E9L9+HPB9M1tpZlOJ+me9QHTe2g54PmXf\nLxFdp+YTHUdHm
"text/plain": [
"<Figure size 576x576 with 8 Axes>"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAI4CAYAAACC61aaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3XucXPP9x/HXO3eRSOQicl8itIlL\nsIhqiXtcU+qnCKJUENHQFAkqbkGLoiWIikutS6paacU1lbpUQhCXBBUkkkgiIRIEuX1+f5yzydnZ\nmd3Z3Zk5c/k8H4957JzvOTPz2Z2zcz7zvcrMcM4555wrJY3iDsA555xzLtc8AXLOOedcyfEEyDnn\nnHMlxxMg55xzzpUcT4Ccc845V3I8AXLOOedcyfEEKEskzZI0IMW+AZIWZOh1pkr6ZSaeyxUXSXMl\nHVDPx/5E0vuZjslVV9NnhXNRki6TdH89H3uKpBdr2P+EpCHJjpX0taSt6/O6dYwxp9czT4DYcKH4\nNnyTF0u6R1KrhjynmfU1s6kZCtFlQfjPtlxS8zo8xiRtk8244pD4e5nZC2a2XZwxFYtkiWj0ApPO\nZ4WksvA9apLF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AGQsBr7QIL3djHwAUGHPoCrgBnAW8DbwOthWdrMbAZwehj7coLz9JQUh/8GOIGgn9udQOII\nwSq/V8LrrA5/h0MIzsNxwMlm9l5d4nVpGQjMCv+HbwaOM7NvwyasscBL4XvUn6AD/F8ImsU/Br4j\n/HJlZrPC+w8RnJdfA58RXCxTqe0ccblxPEEfl0+BvwNjws+ZSo8BPyf4nz8JONrM1pjZbIJ+WC8T\nfH7tALyU8NzTC
"text/plain": [
"<Figure size 576x576 with 8 Axes>"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAI4CAYAAACGHoanAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xu8XNP5x/HPVyQhEpFIREIiQVxC\nCQ3SaitKiWvozyUEoSqNW1X9qtG0KE2rpVp+rnGpW5CIW0rUJaW0FcQtCJoUIZEbIhdBbs/vj71O\n7DNnZs6ck5nZM7Of9+s1r7Nn7T17npnZZ/Yza629lswM55xzzrk0WifpAJxzzjnnkuKJkHPOOedS\nyxMh55xzzqWWJ0LOOeecSy1PhJxzzjmXWp4IOeeccy61PBEqI0lvSBqQY90ASbOK9DxPSfphMfbl\naoOk9yTt28zHflvS28WOyTWU7zvCOQBJF0q6o5mPPVHSP/Osf0TS0GzbSloqacvmPG8TYyz7+csT\noRzCiePz8OHPlXSLpLZrs08z28HMnipSiK6Iwj/fQkmtm/AYk7R1KeNKQubrMrNnzGzbJGOqFdkS\n0vgJp5DvCEk9w2e0bglDdUWUcT6ZV4zzSSmY2QFmdmuOdW3N7B2AEP9vmvs8xXg/ivl/4IlQfoeY\nWVugL7ALcF7C8bgSkNQT+DZgwKGJBtOIbP/0fkJ0xeTHU8nUnU92Bfo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rK307UTP4u8AXh\nx5WZvRGW7yY6LpcC84lOnrk0doy40jqGqA/Mh8D9wAXh+6XOg8DRRP/rxwPfN7MVZjaNqH/Ws0Tf\nW18D/pWx7+eIz
"text/plain": [
"<Figure size 576x576 with 8 Axes>"
]
},
"metadata": {
"tags": []
}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "aqkE0lj2EAYw",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "cV19oXyNEAYz",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}