1107 lines
786 KiB
Plaintext
1107 lines
786 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "view-in-github"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"<a href=\"https://colab.research.google.com/github/PYFTS/notebooks/blob/master/Chen%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": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "x2LMLww79mVt"
|
|||
|
},
|
|||
|
"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."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "Jx-dFMeC9mVz"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Environment Setup"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "H-laCR5H9mV1"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### Library install/update"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 263
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "ftD40EBQ9mV4",
|
|||
|
"outputId": "5cc34a26-3afe-4e2e-fda1-576ac545c453"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Collecting git+https://github.com/PYFTS/pyFTS\n",
|
|||
|
" Cloning https://github.com/PYFTS/pyFTS to /tmp/pip-req-build-dqestlqc\n",
|
|||
|
" Running command git clone -q https://github.com/PYFTS/pyFTS /tmp/pip-req-build-dqestlqc\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=6e839f074268e83537bba8d25fc74ba6934b60ed662a0b17a16c6bfb64c73f7a\n",
|
|||
|
" Stored in directory: /tmp/pip-ephem-wheel-cache-appy12pd/wheels/e7/32/a9/230470113df5a73242a5a6d05671cb646db97abf14bbce2644\n",
|
|||
|
"Successfully built pyFTS\n",
|
|||
|
"Installing collected packages: pyFTS\n",
|
|||
|
" Found existing installation: pyFTS 1.6\n",
|
|||
|
" Uninstalling pyFTS-1.6:\n",
|
|||
|
" Successfully uninstalled pyFTS-1.6\n",
|
|||
|
"Successfully installed pyFTS-1.6\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"!pip3 install -U git+https://github.com/PYFTS/pyFTS\n",
|
|||
|
"#!pip3 install dispy"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "nxGKQF819mWA"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### External libraries import"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 2,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 34
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "3UICJE4q9mWD",
|
|||
|
"outputId": "b8823a18-caa6-4305-d835-35a89c1049bb"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Populating the interactive namespace from numpy and matplotlib\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"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"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "DRj_c1Af9mWJ"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### Common pyFTS imports "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "ROHnRPQr9mWL"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"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 chen\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "noQuGEh79mWQ"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Common data transformations"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "Rf1kbFSn9mWS"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"from pyFTS.common import Transformations\n",
|
|||
|
"\n",
|
|||
|
"tdiff = Transformations.Differential(1)\n",
|
|||
|
"\n",
|
|||
|
"boxcox = Transformations.BoxCox(0)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "Xom5aDUR9mWY"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Datasets"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "4Tf4MrAk9mWa"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### Data Loading"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "QgyjvurE9mWb"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"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"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "qshydqlk9mWg"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### Visualization"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 6,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 336
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "5eedBSif9mWi",
|
|||
|
"outputId": "0678c35a-3e3a-47f2-8549-d0904b2e63db"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmoAAAE/CAYAAAD2ee+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzsnXd4FOX2x79n0yD0EjoYCAEEpIugFBGkesUuVvSiXK+9XQV7F7tiwWvB8ruKoGIF6V167yWE0EsIEEhC6p7fH/PO7ruzs32TnV3ez/PkYeadsrMhM3PeU76HmBkKhUKhUCgUCuthi/QFKBQKhUKhUCjMUYaaQqFQKBQKhUVRhppCoVAoFAqFRVGGmkKhUCgUCoVFUYaaQqFQKBQKhUVRhppCoVAoFAqFRVGGmkKhUCgUCoVFUYZalEJEedKPnYjOSuu3SPvdQURMRDcajr+UiA5I6wuIqNBw3j/Etn8Q0REiqi3tP5yIDhJRjYr4vgqFPxBRLyJaSkS5RHSCiP4mogvFfVAm/q5PE9F6IrpCHJMq7hH5b/9Z6ZxJRDRRHHeEiB41fGZ/ItpORAVENJ+Izqvo761QKGIXZahFKcxcVf8BsA/AP6Sx76RdRwI4AeB2P057v3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B7Jf20zWgvI0HpBlFRKuJaHV2dvDerWAJwU6DbHCr+ai1eX36NkxcsifSl6FQWI4pq/djxGfLAQA3XdgskEP7iTB/N7EezqiMQhFWThUUY9Q3rhp8s7YcdVkvszvf5EdFOtPwTh7Nl5AIuZhAeMIqxPaItGaULYT0ubaNnBJZ+oxUYU3+uygTL/25NdKXoVBYjqW7c
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 720x360 with 6 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"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)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "T3f6SyW99mWn"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### Statistics"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 7,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 143
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "jE-HY1zx9mWo",
|
|||
|
"outputId": "c16e937b-b56b-492c-8f7b-9bf4a9663198"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"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"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 7,
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"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"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "rU7VPjD_9mWt"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Partitioning\n",
|
|||
|
"\n",
|
|||
|
"Наилучшее количество разделов Вселенной Дискурса является задачей оптимизации. Чтобы узнать больше о схемах секционирования, просмотрите блокнот Partitioners. Чтобы узнать больше о сравнительном тестировании, загляните в блокнот «Бенчмарки»."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "0tu0-8Xv9mWv"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"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"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 9,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 475
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "pbMJ7sSe9mW0",
|
|||
|
"outputId": "182effbc-a2d1-4f07-b43e-ddc25c00f7a5"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"Text(0.5, 0, 'Number of partitions of the UoD')"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 9,
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2MAAAG5CAYAAAADC+xpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xt8FOW9P/DPN/dAgBBYEVkkinivGuW0tadaflJPb97aRqunHi+1x1/1eMHWFimtRU9b9NSjWK31Z9UqUi+YUu+tteKlx+OlIF4QtSgNshAgBEJYkmxI8vz+mJl1svvM7Ex2Z2d383m/XrzY7H73mfuz853nmWdEKQUiIiIiIiLKr7KwZ4CIiIiIiGgkYjJGREREREQUAiZjREREREREIWAyRkREREREFAImY0RERERERCFgMkZERERERBQCJmNERCOAiPxQRO7MdayHspSIHOAxdoGILMnFdImIiIpBRdgzQERE/ojIeQC+B2A6gC4AfwAwTynV6fQdpdTPvZbvJzYsInIPgJhS6kdhzwsREdFwsWWMiKiIiMj3AFwP4PsAxgH4NIBpAJ4RkSqH7/DCGxERUQFiMkZEVCREZCyAawBcqpT6k1Jqj1KqFcAZABoBnG3GLRCRFhFZIiJdAM5L7QIoIueIyHoR6RCRH4tIq4h83vb9JebrRrOr4bki8pGIbBOR+bZyPikiL4tIp4i0icitTkmhZnn2E5EXRGSXiDwDYGLK5w+LyGYR2SkiL4rIYeb7FwL4JoAfiEhcRB43379KRD40y1sjIl8d1oomIiLKEyZjRETF4zMA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Il94zxgREREREVEImIwRERERERGFgMkYERERERFRCJiMERERERERhaDoB/DwY+HChYjH42hqakJzc3PYs0NERERERCPYiGoZi8fjHAafiIiIiIgKwohqGYtEIgDAVjEiIiIiIgrdiGoZIyIiIiIiKhRMxoiIiIiIiELAZIyIiIiIiCgETMaIiIiIiIhCEFgyJiI1IvKaiLwpIu+IyDXm+/uJyKsi8oGIPCQiVeb71ebfH5ifNwY1b0RERERERGELsmUsAeAEpdSRAI4C8EUR+TSA6wHcpJQ6AMAOABeY8RcA2GG+f5MZR0REREREVJICS8aUIW7+WWn+UwBOANBivn8vgNPM16eaf8P8fLaISFDzR0REREREFKZA7xkTkXIReQPAVgDPAPgQQKdSqt8MiQGYYr6eAmADAJif7wQwQVPmhSKyQkRWtLe3Bzn7REREREREgQk0GVNKDSiljgIQBfBJAAfnoMw7lFIzlVIzrYc4ExERERERFZu8jKaolOoE8ByAYwHUi0iF+VEUwEbz9UYAUwHA/HwcgI58zB8REREREVG+BTmaYkRE6s3XtQBOBPAujKSs2Qw7F8Cj5uvHzL9hfr5cKaWCmj8iIiIiIqIwVWQOGbbJAO4VkXIYSd9SpdQTIrIGwIMi8lMAqwDcZcbfBeA+EfkAwHYAZwY4b65aWlqwatUqAEBTUxOam5szfIOIiIiIqHStXLlyr4qKijsBHA4+q9irQQCr+/v7v33MMcds1QUElowppd4C0KR5fx2M+8dS3+8FcHpQ8+NXIpEIexaIiIiIiApCRUXFnXvvvfchkUhkR1lZGXuveTA4OCjt7e2Hbt68+U4Ap+higmwZK1rNzc2IxWLJ10REREREI9zhTMT8KSsrU5FIZOfmzZsPd4zJ5wwREREREVFRKmMi5p+5zhxzLiZjREREREREISjqboo7duzAokWLkl0KW1pa2K2QiIiIiChgNyxadNCu7t1VuSpvzKjRfVfOmfO+0+ebN28unzVr1kEAsG3btsqysjLV0
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1080x504 with 2 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"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\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "xd0_sbJN9mW3"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### Comparing the partitioning schemas"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 10,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 367
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "UALZRP2_9mW5",
|
|||
|
"outputId": "4159a800-b252-4d41-869d-c605522913c5"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABIQAAAFKCAYAAABsCIRVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzsvXm8ZMlV3/mLzLw317dlvqrqXa3eJJYZYRAgf8wYDDYIjIxtwIOwR2Is4MN4WGZAH7wAkllsJLCFEYNhBAIhkFiEkIyAQWKR1EILqAUSWnqpltTqtbrrZeZbcr1bzB9x4964cWN73U9Vr7ri9/nUJ7dbuZx3b5wT55xvBKGUwsvLy8vLy8vLy8vLy8vLy8vr6lHjcn8BLy8vLy8vLy8vLy8vLy8vL69LK58Q8vLy8vLy8vLy8vLy8vLy8rrK5BNCXl5eXl5eXl5eXl5eXl5eXleZfELIy8vLy8vLy8vLy8vLy8vL6yqTTwh5eXl5eXl5eXl5eXl5eXl5XWXyCSEvLy8vLy8vLy8vLy8vLy+vq0w+IeTl5eXl5eXl5eXl5eXl5eV1lcknhLyueBFCZsK/jBCyFB7/S+G4byOEUELI/yr9/68ghDwsPH4XIWQlve/b8tdeQAi5QAgZCsd/AyHkEULI1qX4vV5eXl5exxMh5MsIIe8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qo/boGu4Zsn+nqL1zGLvbdHL4/pUgcvn/scH0DYL7aIhdfDTD7u9gsdbBZlqbW8RBw8x3u45jbeebiP9KMInX4O7nESixOcBjTk8TJZi7xkrPvdjzPXGImSlNQav/MKHM8t68iPb39RMr+WRSnjmO2w5zCJb4FHGOtjIKmDu+Vp
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1440x360 with 6 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"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])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "emVoyADD9mW-"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Fitting models"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "9cmdELOH9mW_"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### With original data"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "9_EzXhLN9mXA"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"for count,dataset_name in enumerate(dataset_names):\n",
|
|||
|
" dataset = get_dataset(dataset_name)\n",
|
|||
|
"\n",
|
|||
|
" model1 = chen.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"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "V4OHNIRj9mXF"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"### With transformed data"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "jZk-tH-q9mXG"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"for count,dataset_name in enumerate(dataset_names):\n",
|
|||
|
" dataset = get_dataset(dataset_name)\n",
|
|||
|
"\n",
|
|||
|
" model2 = chen.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"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "Z4YheFdX9mXL"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Predicting with the models"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 13,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 749
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "rHL6JlyL9mXM",
|
|||
|
"outputId": "002a2565-e726-41ef-85c0-a3d5a8cb0592"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd8VfX9x/HXN3snkB0ChL0h7ClDHCCuOnCLOGir1tr2p62Vtlpbq3VUbd0DREVtVRQUt6CIgIyEFXYIgQxCQsgk835/f9yLhJnBzYL38/G4j9x7zvec8zmQm5z7yfd8PsZai4iIiIiIiIiIiIhIfXk0dwAiIiIiIiIiIiIi0jopwSwiIiIiIiIiIiIiDaIEs4iIiIiIiIiIiIg0iBLMIiIiIiIiIiIiItIgSjCLiIiIiIiIiIiISIMowSwiIiIiIiIiIiIiDaIEs4iIiIiIiIiIiIg0iBLMIiIiIiJHMcYU13g4jDEHa7y+rsa4m4wx1hhz1VHbjzfG7KnxerExpuyo/S5wrbvIGJNtjGlbY/wlxpgMY0xoU5yviIiIiEhDKcEsIiIiInIUa23QoQeQDlxUY9lbNYZOA/YDN9Zht3fW3K+19iLXsRYA3wD/AjDGhAHPA7+01ha487xERERERNzNq7kDEBERERFpjYwxHYFxwJXAu8aYGGttdgN3dxeQYow5H7ga+NZ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E+3k3yvGkcSjBLCIiIiIiIiIiIkdYtDmHwrKqRq2F7OPlwQ0jOrJkWy73z9uAj6cHN
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1440x720 with 3 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"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()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 143
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "5GMB4jPS9mXP",
|
|||
|
"outputId": "be4c53cb-3351-44c7-c0a3-954231b91796"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"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>102.65</td>\n",
|
|||
|
" <td>1.76</td>\n",
|
|||
|
" <td>1.56</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>SP500</td>\n",
|
|||
|
" <td>14.49</td>\n",
|
|||
|
" <td>1.14</td>\n",
|
|||
|
" <td>2.60</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>NASDAQ</td>\n",
|
|||
|
" <td>48.39</td>\n",
|
|||
|
" <td>2.36</td>\n",
|
|||
|
" <td>2.02</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Dataset RMSE SMAPE Theil's U\n",
|
|||
|
"0 TAIEX 102.65 1.76 1.56\n",
|
|||
|
"1 SP500 14.49 1.14 2.60\n",
|
|||
|
"2 NASDAQ 48.39 2.36 2.02"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"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",
|
|||
|
" "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 15,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 749
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "UFuHi-j49mXV",
|
|||
|
"outputId": "c187966e-a1af-4b7c-c97a-818225d4c299"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAALICAYAAADyhJW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd0VVX6xvHvTieQBAihBULvHUJHBFSkY0UElKLiqFjGGUexzPzGMo46YsWCIgqKoFJEQJp0pCX0XgIkhJYCCenl7t8fJ0gQlAAJSeD5rHVXkn32O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xph9xpgtxpiWueYONcbszXkNzd9HEREREREREREREZGr6VI2+etqrY3NPWCMqQp0ByJzDfcE6uS82gIfA22NMWWBfwGhgAXCjTGzrLUnr6B+ERERERERERERESkkV9oi4x3gHziB8Rn9gYnWsQYobYypBNwKLLTWxueEyguBHld4fxEREREREREREREpJHkNmC2wwBgTbowZCWCM6Q9EW2s3/25uMBCV6+fDOWN/NH4eY8xIY0yYMSYsJiYmjyWKiIiIiIiIiIjI9SrbZflp8xE+XrqfuKT0wi7nupHXFhmdrLXRxpjywEJjzC7geZz2GPnOWjsOGAcQGhpqLzJdREREREREREREioKkEzD7r9CgHzQdAMYU+C2zsl3M3nKUDxbvZX9MMgDv/7KXIe1CGNm5FkF+3gVew/UsTwGztTY65+sJY8wM4EagBrDZOH9JqgAbjDFtgGigaq7Tq+SMRQNdfje+9MrKFxERERERERERkcJw+GQKh0+mcuRUKkcT0jgen8jgPU9QL30r7JqN3TYN0+cdCLhgE4MrlpXtYuamI4xdso8DscnUr+jHR4NbUqd8KT5aup/xKw8wac0hBrWpxiPtggg6uhQa9gMPBc75yVj75wuEjTElATdr7emc7xcCL1tr5+WacxAItdbGGmN6A6OAXjib/L1vrW2Ts8lfONAy57QNQCtrbfyf3T80NNSGhYVd3tOJiIiIiIiIiIhIvhu/8gCvzN5xzth/fb5iIPN5w/dvpCWc4Dmv7/D09MLt1teg5f35tprZ5bJM3xjN+7/sJTI+hYaV/Hnipjp0b1gBN7ez94iISWLskv0kbP6JVzzGU8nEk9V6JB6938qXOq51xphwa23oxeblZQVzBWBGzkplD2By7nD5AubihMv7gBRgOIC1Nt4Y8wqwPmfeyxcLl0VERERERERERKRoiU/O4N2Fe+hQK5BHu9SmUmkfqh6cjtec+dB+FM/c8hLfro/ktrmt+Vf6p7T76QlnNXO/96FM9Su697boBF76cRsbI0/RJDiAz+8P5aYG5TEXCK9rlkjlbbf3wHMaR71rMDulLn3Wj4O63aHOLVdUh5x10RXMhU0rmEVERERERERERIqOV2bvYMKqA8x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mtntGMHFSGPevHQu4ICAYSpR1rnnmq2/gZd/jeqGAWURERERERERERP7Q/A17GHHiP9zuvgqqtoM7PoUy1S/9QsZgyjeg3alYnttxnKj4FKqW9T1v2s/bjnIoLoXRQ1pijIHjO2Du351+z8GtYNBUCG55xc/VpV55Xms9mtVh0bRZOw53ss+bk12yPO7P7L3ie13LFDCLiIiIiIiIiIjIBWUeWk/zOfdS3j0OV5fncbvhb+B+BZFiUD2CY2djjGHi6oO80LvhOYettXyybD81g0rSvUF5WPASrB4LPv7Q9z1ocf8FN++7XH/r1ZyH497jwYNxmIwkypjTlCGJMiaJ0pymtLs7aqDx5xQwi4iIiIiIiIiIyPmsJXXKcLJdlk3dp9Cq461Xfs2g+rhvmMjd9X2Ysj6Kp26uS0nvsxHly
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1440x720 with 3 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"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()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 16,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 143
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "0ZotUMWW9mXY",
|
|||
|
"outputId": "b6c483fa-0f67-48ff-a66f-2645dd0a4d79"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"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>84.15</td>\n",
|
|||
|
" <td>1.42</td>\n",
|
|||
|
" <td>1.28</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>SP500</td>\n",
|
|||
|
" <td>5.58</td>\n",
|
|||
|
" <td>0.40</td>\n",
|
|||
|
" <td>1.01</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>NASDAQ</td>\n",
|
|||
|
" <td>27.98</td>\n",
|
|||
|
" <td>1.33</td>\n",
|
|||
|
" <td>1.17</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Dataset RMSE SMAPE Theil's U\n",
|
|||
|
"0 TAIEX 84.15 1.42 1.28\n",
|
|||
|
"1 SP500 5.58 0.40 1.01\n",
|
|||
|
"2 NASDAQ 27.98 1.33 1.17"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 16,
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"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",
|
|||
|
" "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"colab_type": "text",
|
|||
|
"id": "g_pyPx8m9mXe"
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Residual Analysis"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 17,
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"base_uri": "https://localhost:8080/",
|
|||
|
"height": 1000
|
|||
|
},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "h5TFuyfW9mXh",
|
|||
|
"outputId": "cff3f28c-4e26-4d2e-e0ce-ddff3bd05879"
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAI4CAYAAACGHoanAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3XecVNX5x/HPlyoIihSRDiqaYNe1pmjEAjZMTFRij5FgSYya2LD9RIyxa2LD2MUaG4moAaIxxQJ2wQIWEBAEKYIgCPv8/rhnYXZ2ZnZ2d2bulOf9es1r5557595nZ+7Offacc8+RmeGcc845V4maxR2Ac84551xcPBFyzjnnXMXyRMg555xzFcsTIeecc85VLE+EnHPOOVexPBFyzjnnXMXyRKiAJE2RtFeadXtJmpWj47wg6Ze52JcrD5I+lbRPI1/7A0kf5DomV1em7wjnACRdIun+Rr72eEn/ybD+GUnHpdpW0jJJmzbmuA2MseDXL0+E0ggXjhXhw58r6W5J7ZqyTzPbysxeyFGILofCH98iSa0b8BqTtHk+44pD8u9lZv82sy3jjKlcpEpIEy842XxHSOobPqMWeQzV5VDS9WReLq4n+WBmg83snjTr2pnZxwAh/ssae5xcvB+5/DvwRCizg82sHbA9sANwXszxuDyQ1Bf4AWDAIbEGU49Uf/R+QXS55OdT3tRcT3YEqoALkjdQpFKuy/W+H4VSKW94k5jZXOA5ooQISa0lXS1pZshmb5XUJqzrLOnvkhZLWijp3zUnduJ/g5LahCx4kaSpwM6Jx0z+rzwxA5e0UTjG/PD6v0vqmSp2SZtL+pekJZIWSHo4D29RqTsWeBm4GziupjC5ijbxP3dJL4b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es>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAI4CAYAAACC61aaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3XecVNX5x/HPl2YBFREkiiAqaIImEkMsMUasQSyoMUaCiiViI9HoLxHFqFFRY+yxRKwY10KsxGABIibGikos2LAhiIoNC4KU5/fHOQN3h5kt7MzcKc/79drXzj23nd29O+eZU2VmOOecc87VklZpZ8A555xzrtQ8AHLOOedczfEAyDnnnHM1xwMg55xzztUcD4Ccc845V3M8AHLOOedczfEAqEgkvSSpf559/SXNLNB9Jkv6VSGu5aqLpLcl7byC524n6dVC58ktr6H3CueSJJ0h6eYVPPcQSY82sP9+SUNzHSvpS0kbrsh9m5nHkpZnHgCxtKD4Ov6R35d0o6QOLbmmmW1qZpMLlEVXBPGf7VNJKzXjHJPUq5j5SkP2z2Vm/zGzTdLMU7XIFYgmC5imvFdI6hn/Rm2KmFVXBFnlyweFKF+Kwcx2M7MxefZ1MLM3AWL+z17R+xTi91Go/wcPgJbZ08w6AH2B7wMnp5wfV0SSegLbAQbslWpmGpHrn9wLQldI/jwVXaZ82QLoB5yafYCCWimTG/19lEKt/LKbzMzeBx4kBEJIWknSBZJmxGj1r5JWifs6S7pP0meSPpH0n8wDnPzUJ2mVGOV+Kmka8MPkPbM/fScjbElrxnvMieffJ2m9XHmX1EvSI5LmSvpI0u1F+BVVi4OBJ4AbgaGZxOwq2OQndUn/jsn/i59efhHTj5A0PT4D4yStmzh/U0kT4r4PJJ0S01eSdImk9+LXJZmaqEwTqaSTJL0P3JArLR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fEJ08ueJJo+OJ3p9+RM2L+wN7AU8S9Rt6ETgx1MDtTvQNPW4xmyc3dwJnSdo/9M35JfCsmb0DPAh0l/QDRZ2jt5E0MPa4n0nqJqkrUVNGY+cJuQH4rqSBinSQdHTWh2nGNsAqYLWkzwHnNvB7xT1LlKT/WFJbRXPeHEvoC+VKR9I3JHUL3/hXhOINwNLwM/vc+6GkXRQNQ/4lcJeZrSPq+3OspC8p6sB8OQ0nNQ2dI65MzOxd4P+AX0naUtGgh7PZ/DPhIEknhr44PwA+JRrwkUmUlwJIOov6nZC3B74f/n+/TvSZN7GRYdb7jAg11HcT1ao/Z2bzGvmcuRQ6r3P9HzSJJ0JFMrOlRP1tLgV+QtT89UyoNp5MVEMD0DdsrwaeBq41s6k5nvK/iar53ibqeJpdjXgh0QVmBVEnx/tj+/4AbEVUO/UMUdNcPl8AnpW0GpgAXGhhLgjHGcDNZjYv1Jy9Z9EIwT8T/c2vIupLsZio2jf7G87lwK2hCvpkM5sM/BdwD9G38N2IOgwSqrkPJ3pP3wPeJOoACPALYDrwMvAK8EIoK5qZTQfOCbF/QHR+npnn8P8E/oOo/9sNQPZIws1+r6zXWRt+h6OIzr9rgdPN7PXGxOuKMgyYGf53rwZONbOPQ9PWGOCp8B4dTNRR/n+JmsnfBj4hfLkys5nh/jii83I1sITo4plPQ+eIK6/TiPrALATuAy4Lny8ZDwCnEP2vfxM40cw+M7NZRP2znib63Po88FTWcz9LdJ1aRnQenWRm2U2lDbkR6BfOv/i16dbwmg01ixWr0Hmd6/+gSbR5U6FzzrlaFr5ZryBq9no76Xhc7ZDUm6hJdUczW5V0PMXyG
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 576x576 with 8 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"tags": []
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"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])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "Mj_ik15O9mXl"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": []
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"colab": {},
|
|||
|
"colab_type": "code",
|
|||
|
"id": "pQn4vlUl9mXn"
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": []
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"colab": {
|
|||
|
"include_colab_link": true,
|
|||
|
"name": "Chen - ConventionalFTS.ipynb",
|
|||
|
"provenance": []
|
|||
|
},
|
|||
|
"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
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 0
|
|||
|
}
|