1112 lines
798 KiB
Plaintext
1112 lines
798 KiB
Plaintext
|
{
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 0,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"name": "Chen%20-%20ConventionalFTS.ipynb",
|
|||
|
"version": "0.3.2",
|
|||
|
"provenance": [],
|
|||
|
"toc_visible": true
|
|||
|
},
|
|||
|
"kernelspec": {
|
|||
|
"display_name": "Python 3",
|
|||
|
"language": "python",
|
|||
|
"name": "python3"
|
|||
|
}
|
|||
|
},
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"id": "view-in-github",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"[View in Colaboratory](https://colab.research.google.com/github/petroniocandido/pyFTS/blob/master/pyFTS/notebooks/GOOGLE%20COLAB%20Chen%20-%20ConventionalFTS.ipynb)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "q_6DGrIna0wP",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"# First Order Weighted Fuzzy Time Series by Yu(2005)\n",
|
|||
|
"\n",
|
|||
|
"H.-K. Yu, “Weighted fuzzy time series models for TAIEX forecasting,” \n",
|
|||
|
"Phys. A Stat. Mech. its Appl., vol. 349, no. 3, pp. 609–624, 2005."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "MwYpk5PVa0wR",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"## Environment Setup"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "FSeYkqdJa0wT",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### Library install/update"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "1Dk0hhPia0wW",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 384
|
|||
|
},
|
|||
|
"outputId": "e0b16387-58cd-4c72-8244-22511478ea33"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
"!pip3 install -U git+https://github.com/petroniocandido/pyFTS\n",
|
|||
|
"!pip3 install dill"
|
|||
|
],
|
|||
|
"execution_count": 4,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Collecting git+https://github.com/petroniocandido/pyFTS\r\n",
|
|||
|
" Cloning https://github.com/petroniocandido/pyFTS to /tmp/pip-req-build-2nfx68ta\n",
|
|||
|
"Building wheels for collected packages: pyFTS\n",
|
|||
|
" Running setup.py bdist_wheel for pyFTS ... \u001b[?25l-\b \b\\\b \bdone\n",
|
|||
|
"\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-ts2ity0t/wheels/84/d7/1e/a333c7128f25b347640740859808db094c4478e98663cd2297\n",
|
|||
|
"Successfully built pyFTS\n",
|
|||
|
"Installing collected packages: pyFTS\n",
|
|||
|
" Found existing installation: pyFTS 1.2.2\n",
|
|||
|
" Uninstalling pyFTS-1.2.2:\n",
|
|||
|
" Successfully uninstalled pyFTS-1.2.2\n",
|
|||
|
"Successfully installed pyFTS-1.2.2\n",
|
|||
|
"Collecting dill\n",
|
|||
|
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/91/a0/19d4d31dee064fc553ae01263b5c55e7fb93daff03a69debbedee647c5a0/dill-0.2.7.1.tar.gz (64kB)\n",
|
|||
|
"\u001b[K 100% |████████████████████████████████| 71kB 2.4MB/s \n",
|
|||
|
"\u001b[?25hBuilding wheels for collected packages: dill\n",
|
|||
|
" Running setup.py bdist_wheel for dill ... \u001b[?25l-\b \bdone\n",
|
|||
|
"\u001b[?25h Stored in directory: /content/.cache/pip/wheels/99/c4/ed/1b64d2d5809e60d5a3685530432f6159d6a9959739facb61f2\n",
|
|||
|
"Successfully built dill\n",
|
|||
|
"Installing collected packages: dill\n",
|
|||
|
"Successfully installed dill-0.2.7.1\n"
|
|||
|
],
|
|||
|
"name": "stdout"
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "zWHClZPOa0we",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### External libraries import"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "CYbYGUaIa0wg",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 34
|
|||
|
},
|
|||
|
"outputId": "6682aa12-84fd-4918-edb8-dffcac14b8f9"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 5,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Populating the interactive namespace from numpy and matplotlib\n"
|
|||
|
],
|
|||
|
"name": "stdout"
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "iw-8cPBfa0wr",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### Common pyFTS imports "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "jFP_AhMAa0ws",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 17
|
|||
|
},
|
|||
|
"outputId": "ceae202d-0dba-4bec-c6c5-34e35244906d"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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 yu\n"
|
|||
|
],
|
|||
|
"execution_count": 6,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "wkxZ9snZa0wy",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"## Common data transformations"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "9bQdnNG9a0w0",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 17
|
|||
|
},
|
|||
|
"outputId": "3a6fb8b0-dab9-490c-99e7-928fbc2b6d64"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
"from pyFTS.common import Transformations\n",
|
|||
|
"\n",
|
|||
|
"tdiff = Transformations.Differential(1)\n",
|
|||
|
"\n",
|
|||
|
"boxcox = Transformations.BoxCox(0)"
|
|||
|
],
|
|||
|
"execution_count": 7,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "oXa3wbI3a0w8",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"## Datasets"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "Yu55rAZCa0w-",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### Data Loading"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "wY7sCz4ba0xA",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 17
|
|||
|
},
|
|||
|
"outputId": "56376909-1f95-4899-91b9-b3574410e93a"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 8,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "6DMPncjTa0xF",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### Visualization"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "TVQoxoL5a0xH",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 335
|
|||
|
},
|
|||
|
"outputId": "b57b45fb-6694-452f-c4f4-e28632bf8780"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 9,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAE+CAYAAAAnGdyNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzsnXeYVNX5xz/bly1sgaX3dpCOgICA\nYMGusXeNvUSjJpZomiU/o5EYjSWWqLEl9t4VEem9Ixx6b8uyne0zvz/uvbN37tzpszuF83keHmbO\nLXNmdu7c97zl+yY5nU4UCoVCoVAoFNEnOdoTUCgUCoVCoVBoKMNMoVAoFAqFIkZQhplCoVAoFApF\njKAMM4VCoVAoFIoYQRlmCoVCoVAoFDGCMswUCoVCoVAoYoTUaE9AEThCiOeB4/WnfYE9QI3+fIyU\nslIIcRvwf8AZUsq5pmMfBLpJKa8XQkwBvgO2WF9DSjlQCHETcBNwjJSyUT/+NOAFYIiUsrIl3p9C\nEQpCiFHA40BXtMVmCXAPsAvYCkh912RgH3CHlHK5fh18Bewwne5jKeX9Qogk4FHgXMBpjOuvlw+8\nCgwB6oGHpZTvteibVChMCCGcwKtSyutMY1OAB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b0FlwFlUsqJwCPAo/o5ngLukFJOAPJi\nqYfWpl3lrNh0kN3F1VTVRMZ1r7xmCoUiXvl0ztZoT0GhaBXe+Fa6HheX1XDtYzO49rEZHrbAZ3Nb\n7poIxGNmp800BbhZf/w5cDcggcVSynIAIcRcYAKaNtMb+r7TgVf1KrXeUsrFpnOcBHwd8juJIJ+a\nPvBQvWVWoi7wo
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.figure.Figure at 0x7fd490230908>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "5H0st-qfa0xR",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### Statistics"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "74fIGOQaa0xT",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 143
|
|||
|
},
|
|||
|
"outputId": "1b268850-71d7-4547-9efa-c44f79ebafdb"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 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>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": 10
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "i-bNzLfta0xd",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"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."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "PwgWxxNCa0xg",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 17
|
|||
|
},
|
|||
|
"outputId": "d022f8f5-b1b1-4cef-d66d-e773cb7997ee"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "g7_VBSt5a0xl",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 474
|
|||
|
},
|
|||
|
"outputId": "4f94ca3b-91cb-4caf-de47-d74c29fb795c"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 12,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "execute_result",
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"Text(0.5,0,'Number of partitions of the UoD')"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"execution_count": 12
|
|||
|
},
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2EAAAG4CAYAAADMou/xAAAABHN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g\nG2Bp+G/LqtBtgLuyqlfF/PmXsmLFACtWDAAwb97F9PXN4NhjP5F10SIiIiIiMo5lOTHHO4HPAJjZ\nq4FpwC3AoeHrhwI3AXcDu5rZpmY2jeB6sNsyrBcAK1YMMLBigAk93Uzo6WagKiETERERERHJSpbD\nEb8FzDez24Be4HjgXuD7ZnYc8CRwpbsPm9lpwM3AKHBeZZKOrE2c0ot94EAA/FrNA9JOmsJeRERE\nRCRalrMjDgJHRLy0X8R7rwOuy6ouUgxNXy8iIiIisrEshyPKONbfP4e+vhn09c1QL5iIiIiISBUl\nYSIiIiIiIjnKfIr6rJR9dkNdMyUiIiIiMj6VNgmrzG7YFd60eaCEMxvqmikRERERkfGntEkYlHt2\nw/7+OSxZ8sD6xyIiIiIiMj7omjAREREREZEcKQkTERERERHJkZIwERERERGRHJX6mjBpnWZnFBER\nEREphpKwcUyzM4qIiIiI5E/DEcep/v459PXNoK9vhnrBRERERERypCRMREREREQkR0rCRERERERE\ncqQkTEREREREJEdKwkRERERERHKkJExERERERCRHmqJeRERERERi++TJJz0EbN3GVS79xryv7lTv\nRTP7MjAb2BKYCjwOvOjuh5jZ7sAdwN+7+/3h+48G3uTup5jZFWHsX6tWeSNwVRi3u7u/YGZdwF3A\nCe7++zZ+tkhKw
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.figure.Figure at 0x7fd4900b7d68>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "JlF5RWvKa0xs",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### Comparing the partitioning schemas"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "WqxZA04Za0xt",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 366
|
|||
|
},
|
|||
|
"outputId": "8a210c60-84f8-425e-8597-b9b8cd7d0dc4"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 13,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABH8AAAFJCAYAAAACMIGVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzsvXm0JclZH/jL9e737bX1ooUlBQgz\nNothgEE+ZlhsbIyN7fFYA8xIwDAwxgNmWGQkBEhqFoFpCSR0MIMBg0AYhGQESLQEAqkbSa211ers\nbnVVvap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//63Ys47/fvfijnv9O9/q+a8Vmg5wXA3yom7YV/rd3b7z3mnf/9bMeet+P7XA5WcuOsyf2zb\numHjbtQYPZ+eT8/37JpP4/bHZ3p/3Yo57/TvfyvmvNO//62Y807//rdqTo3bH/os3f5z3unf/1bM\nead//1sx5634/jcLd53zR0NDQ0NDQ0NDQ0NDQ0NDQ0NjDu380dDQ0NDQ0NDQ0NDQ0NDQ0LiLoZ0/\nGhoaGhoaGhoaGhoaGhoaGncxtPNHQ0NDQ0NDQ0NDQ0NDQ0ND4y6Gdv5oaGhoaGhoaGhoaGhoaGho\n3MXQzh8NDQ0NDQ0NDQ0NDQ0NDQ2Nuxh2lUGe570QwB8D+EXf919f+N3XAng1gATAO3zf/6kb/i01\nNDQ0NG5raDmhoaGhoaGClhMaGhoatxalmT+e57UAvA7AQ5IhDwL4FwC+EsDXeZ73+Tfu62loaGho\n3O7QckJDQ0NDQwUtJzQ0NDRuPaqUfQUA/hGAreIvPM97PoAj3/cv+b5PALwDwD+8sV+xOiil2D0a\nl47rBX2EcagcQ
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.figure.Figure at 0x7fd490227b38>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "k99jlRB5a0x0",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"## Fitting models"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "eCsrFI8Ma0x1",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### With original data"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "ojs17_Fka0x2",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 17
|
|||
|
},
|
|||
|
"outputId": "b4f3614b-c18f-4c2d-e1af-e124801ff0ff"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
"for count,dataset_name in enumerate(dataset_names):\n",
|
|||
|
" dataset = get_dataset(dataset_name)\n",
|
|||
|
"\n",
|
|||
|
" model1 = yu.WeightedFTS(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": 14,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "16bVx9F1a0x6",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"### With transformed data"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "k5JA2gOUa0x6",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 17
|
|||
|
},
|
|||
|
"outputId": "98f3e3e2-30cf-453e-848b-6da13f07587c"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
"for count,dataset_name in enumerate(dataset_names):\n",
|
|||
|
" dataset = get_dataset(dataset_name)\n",
|
|||
|
"\n",
|
|||
|
" model2 = yu.WeightedFTS(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": 15,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "Dk_45XTda0yB",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"## Predicting with the models"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "5DDHqD9ta0yE",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 749
|
|||
|
},
|
|||
|
"outputId": "ce7ae9dc-8163-4f36-fc34-bdd88c9980d0"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 16,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzs3Xd8XOWZ9//PFPUua9SbbcnHvTcw\nzRhMDyU4hBYCgc0SNrtkN5uym4Rlk908u09+e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mXx\nzpYCbMD1SzIv6Hy9CQtx8le3zMBms/Hbtw7R3Hb+GdVyJptlWYGO4RxVVe7RF9QIcbmiqKpyBzoM\nGWeUdxIoyj0JFOWeBILyTgJFuSeBotyTQFDeDa8XjrzK9rI9tHv8OB22C+6BDNDh8ePx+QkJcuB0\nnNtqw+e3aOvw4bDbCA2+8POdNxavH4/Xj91uw2G3YQNsNk61AAlzhvLNeQ+THJF4zr7jIfdcrqge\ne6E4RzoQERERERERERERGVu8fi9bynbg8wKecBKiwnHYB957+ZzjOv2U17bgtxzExoad83h1QxtW\nh5f4uHCCncPcjCEEqupbaW/z4evh4VafjbLqNpIjhjeMsUYFZhERERERERERETmv0qZyfJYPb3UG\n16bcyJ2XXFh7jNM99fJe9h2o4fEHFjIxJfrU9oJyN08+t52pmbF85+b5Q3a+8/FbFuU1LTS1emhu\n9dDU6qGpzUNTi
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.figure.Figure at 0x7fd48c948c88>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "H0j4d4SRhnO7",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {}
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
""
|
|||
|
],
|
|||
|
"execution_count": 0,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "zYiVnuHva0yS",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 143
|
|||
|
},
|
|||
|
"outputId": "6ab265ec-ed90-489b-c18a-b7f2f9a6baa9"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 17,
|
|||
|
"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.76</td>\n",
|
|||
|
" <td>0.79</td>\n",
|
|||
|
" <td>1.41</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>SP500</td>\n",
|
|||
|
" <td>16.01</td>\n",
|
|||
|
" <td>0.63</td>\n",
|
|||
|
" <td>2.88</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>NASDAQ</td>\n",
|
|||
|
" <td>48.70</td>\n",
|
|||
|
" <td>1.19</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.76 0.79 1.41\n",
|
|||
|
"1 SP500 16.01 0.63 2.88\n",
|
|||
|
"2 NASDAQ 48.70 1.19 2.03"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"execution_count": 17
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "1WHz2HSca0yc",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 749
|
|||
|
},
|
|||
|
"outputId": "433f3d6d-de7e-4598-d280-a2300f5ad511"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 18,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzs3Xd8VPeZ7/HPmabeu4Q66IgierEN\ntjE2GNvBJa5xS5w4mzg92ezeJLubsi333s1md5O7yabZiR0ntkls3I0LGAOmCAmEKDqgBqih3uvM\nnPuHZAfbYIQsMQJ936+XXi/pzO+c33OkBzHz6DfPz7BtGxERERERERERERGRc+UIdAAiIiIiIiIi\nIiIicmFSgVlERERERERERERExkQFZhEREREREREREREZExWYRURERERERERERGRMVGAWERERERER\nERERkTFRgVlERERERERERERExsQV6ABERERERCYj0zR/Dlw18mUuUAf0jXy9xLKsLtM0vwT8M3CD\nZVnbTzn3+8A0y7IeNE1zJfAqUPn+OSzLyjdN83PA54CllmV5R86/DvgfYI5lWV0TcX8iIiIiIuNB\nBWYRERERkdOwLOuhdz43TbMauNeyrG3vG3Yf8PfA/cB2zuy4ZVn5Z5jnF6Zp3gb8DfBD0zTDgJ8B\nn1VxWUREREQmO7XIEBEREREZA9M0ZzO8ovnXwLWmaQZ9hMs9CHzdNE0T+EfgDcuyXh2HMEVERERE\nJpQKzCIiIiIiY/Mp4PeWZfUDbwA3jvVClmUdY3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||
|
"<matplotlib.figure.Figure at 0x7fd48af924a8>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "HTkB2pt8a0ym",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 143
|
|||
|
},
|
|||
|
"outputId": "c8a2a240-7297-41ce-fb89-c9fee7bafce2"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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": 19,
|
|||
|
"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>71.41</td>\n",
|
|||
|
" <td>0.61</td>\n",
|
|||
|
" <td>1.09</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>SP500</td>\n",
|
|||
|
" <td>6.93</td>\n",
|
|||
|
" <td>0.25</td>\n",
|
|||
|
" <td>1.25</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>NASDAQ</td>\n",
|
|||
|
" <td>24.51</td>\n",
|
|||
|
" <td>0.60</td>\n",
|
|||
|
" <td>1.02</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Dataset RMSE SMAPE Theil's U\n",
|
|||
|
"0 TAIEX 71.41 0.61 1.09\n",
|
|||
|
"1 SP500 6.93 0.25 1.25\n",
|
|||
|
"2 NASDAQ 24.51 0.60 1.02"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"execution_count": 19
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "IfqcqhGEa0yx",
|
|||
|
"colab_type": "text"
|
|||
|
},
|
|||
|
"cell_type": "markdown",
|
|||
|
"source": [
|
|||
|
"## Residual Analysis"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "ABpKELU3a0yz",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {}
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
""
|
|||
|
],
|
|||
|
"execution_count": 0,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "rp_lHXPua0y6",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {},
|
|||
|
"outputId": "0e831fcc-36c3-4183-a734-f52dde9c96a6"
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"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(dataset, [model1, model2])"
|
|||
|
],
|
|||
|
"execution_count": 0,
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjkAAAI4CAYAAACIt/jIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzs3XmcXFWZ//HPt7uz7xsBEkICCWBY\nDWEfEUF2BMYFwVGiItE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fB8WyiXpe4oWWnxGsXVTJE0L9edL6s7MOld+Ihq+W0s0XPUinUODdcOHq5xz\nzpWVpOOJ8ltuNbODQtk3iabjX6doivYwM/uipDOIcj/OIMpT+q6ZHRWSc+cCU4kSb+cBh5vZ2hq8\nJNegvCfHOedcWZnZX4gSW+POAW4Jt2+hc4Xcc4iCITOzOURrx+xBtFjjbDNbEwKb2UQrNTtXsF16\n47iRI0fa+PHja90MV2bz5s1bZWaj8tfcdfi13nM10PU+2syWhdvL6VwIcQzpi8YtCWXZynPya73n\nKuVa36WDnPHjxzN37txaN8OVmaSCVyHdVfi13nM14vVuZiapbLkSkqYTbbHAuHHj/FrvoUq51n24\nyjnnXDW8FYahCN9XhPKlpK+WOzaUZSvvwsxuNLOpZjZ11KhG6NRy1eJBjnPOuWqYRedCjtOINsRM\nlV8YZlkdDawPw1r3A6eE1YWHEa2Oe3+1G+0a2y49XOWcc678JN1OtEnmSElLiNZQuQ6YKekiolWD\nzwvV7yOaWbWAaO+njwGY2RpJXwGeCPWuMbPMZGbncvIgxznnXFmZ2QVZDnXZ9NKidUwuyXKem+nc\nRsC5ovlwlXPOO
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.figure.Figure at 0x7f1145edefd0>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
},
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjgAAAI4CAYAAABndZP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzs3XecXHW9//HXO9tSSUghkARIIAEM\nIAiR5k9BQgmohKvoBQuRi8QCWPBeDViwi+WK5aIIgoCFchE1CoohtIsSIH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uakmu13vVJzhjx45l7ty5SYfhSkxSzrOMVhO/3muTX++uluR6vXsTlXPOOeeqjic4zjnnnKs6\nJUlwJF0vaZWk52Jlh4eFt56SNFfSUaFckn4qaaGkZxRbTl3SNEkLwk9vFt9zzjnnXBUrVQ3ODcCU\ntLLvA183s8OJptP+fig/jWjq7AlEy9H/AiC2fsfRwFHA5ZJ2L3rkzjnnnKs4JUlwzOxBorUvOhQD\nu4XtwbSv7jsVuMkic4iWlN8LOBWYZWZrzWwd0YJ86UmTc84551yio6g+C9wt6YdEidZxoXw0sDh2\n3pJQlq28E0nTiWp/2Gef9BXtnXPOOVftkuxk/Engc2a2N/A54LpC3bGZXWNmk8xs0ogRNTc1hKsQ\nmfqmpR3P2h/NOedc15JMcKYBd4Tt/yXqVwOwFNg7dt6YUJat3LlKdQNdN7Nm7I/mnHOue0kmOMuA\n48P2icCCsD0TODd8ez0G2GBmy4G7gVMk7R46F58SylyNumf+Sk784f0sXrs16VB6JEvftLhs/dGc\nc851oyR9cCTdD
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.figure.Figure at 0x7f11461d7dd8>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
},
|
|||
|
{
|
|||
|
"output_type": "display_data",
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjgAAAI4CAYAAABndZP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzs3Xl8XFX9//HXp9m6b7SULpQUKGBV\nNmNBUSxb2SlfRYSvSkW+9quCguBSXABxQ7/8AHEBq6CgCNSVKhUohbIoFFr2srRpKbSlS7rvTZN8\nfn/cM8lkMpNM0sz+fj4eeeTec8/c+dzJncxnzj33H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hmSY\nmaU9mmgp0HlfGnTet6Vzv/ile97rEpWIiIgUHSU4IiIiUnSU4IiIiEjRUYIjIiIiRUcJjoiIiBQd\nJTgiIiJSdJTgiOSYmd1uZmvM7JUU283MbjazWjN7ycyOzHaMIiKFRgmOSO79Djilne2nAmPDzxTg\nlizEJCJS0JTgSF6pXbOFLTt3J9321OJ1nD/taRoam7IcVWa5++PA+naqTALu9MjTwEAzG56d6ERE\nClPRj2QsheXEGx7nXcP7869LP9xm21fufYFVm3eyessuRg7slYPocmYksCxufXkoWxlfycymELXw\nMHr06KwF1xkTJkwAYM6cOR2W53NdEYDqqfenXXfpdadnMBJJRi04kndeW7k5afmwAT0B6NdTeXky\n7j7N3WvcvWbo0LbTtEyYMKH5A7u9ss6Wd3YfxWBPX4fuqCsi7VOCI3nD3dvd/uKyjQD071mRjXDy\nyQpg37j1UaFMR
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.figure.Figure at 0x7f1145991940>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
}
|
|||
|
}
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "9xKhBiuQa0y-",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {}
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
""
|
|||
|
],
|
|||
|
"execution_count": 0,
|
|||
|
"outputs": []
|
|||
|
},
|
|||
|
{
|
|||
|
"metadata": {
|
|||
|
"id": "c9NCUKoQa0zB",
|
|||
|
"colab_type": "code",
|
|||
|
"colab": {}
|
|||
|
},
|
|||
|
"cell_type": "code",
|
|||
|
"source": [
|
|||
|
""
|
|||
|
],
|
|||
|
"execution_count": 0,
|
|||
|
"outputs": []
|
|||
|
}
|
|||
|
]
|
|||
|
}
|