Skip to content

Instantly share code, notes, and snippets.

@ngupta23
Created November 2, 2021 10:56
Show Gist options
  • Save ngupta23/5ea07c429625ed536aa7922e19e94ec4 to your computer and use it in GitHub Desktop.
Save ngupta23/5ea07c429625ed536aa7922e19e94ec4 to your computer and use it in GitHub Desktop.
pycaret_ts_tune_models.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "pycaret_ts_tune_models.ipynb",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"adb7060989e84bf79d76f0621182ceff": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_35f925cd2a224a2a95cd9e920ea2ec70",
"_dom_classes": [],
"description": "Processing: ",
"_model_name": "IntProgressModel",
"bar_style": "",
"max": 3,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 3,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_e15c83c8b9984d3c825b86faf5267ddc"
}
},
"35f925cd2a224a2a95cd9e920ea2ec70": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"e15c83c8b9984d3c825b86faf5267ddc": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"2984e020d89f4e39a09d7a5284e07fac": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_e61e651987f34f13a13ea321fec44665",
"_dom_classes": [],
"description": "Processing: ",
"_model_name": "IntProgressModel",
"bar_style": "",
"max": 4,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 4,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_7cb79b7251c6401f9536ee6ee84cd92b"
}
},
"e61e651987f34f13a13ea321fec44665": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"7cb79b7251c6401f9536ee6ee84cd92b": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"7e657717877a499383df0f51936647ce": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_cf653223634b42dbb7da06d44ca1be55",
"_dom_classes": [],
"description": "Processing: ",
"_model_name": "IntProgressModel",
"bar_style": "",
"max": 7,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 7,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_56b1213809724f369fbe12dec92eb755"
}
},
"cf653223634b42dbb7da06d44ca1be55": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"56b1213809724f369fbe12dec92eb755": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"119b936a4cfc4961aa7097d917b53a95": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_8b401026306848dd866e3250e4327512",
"_dom_classes": [],
"description": "Processing: ",
"_model_name": "IntProgressModel",
"bar_style": "",
"max": 7,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 7,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_e25e1ddd46c74ccbb80caeb79f13ca98"
}
},
"8b401026306848dd866e3250e4327512": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"e25e1ddd46c74ccbb80caeb79f13ca98": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"eaa6868d64f64b1baf5915bc53a5964b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_56d3a7026f1a49e290ee2b6968ccc3fa",
"_dom_classes": [],
"description": "Processing: ",
"_model_name": "IntProgressModel",
"bar_style": "",
"max": 7,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 7,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_15d588055f634935985bf37ec432f21d"
}
},
"56d3a7026f1a49e290ee2b6968ccc3fa": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"15d588055f634935985bf37ec432f21d": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"2270d7c69841478cb8a605207bd22c61": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_9f1ce398a2244e11b655f1010f43faee",
"_dom_classes": [],
"description": "Processing: ",
"_model_name": "IntProgressModel",
"bar_style": "",
"max": 7,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 7,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_7c53fde06be74021935a10e5df8cd1bd"
}
},
"9f1ce398a2244e11b655f1010f43faee": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"7c53fde06be74021935a10e5df8cd1bd": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
}
}
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/ngupta23/5ea07c429625ed536aa7922e19e94ec4/pycaret_ts_tune_models.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "m0dPuDxHJbh0",
"outputId": "65cb4398-d66e-4d56-f8d6-3293736c85c8"
},
"source": [
"!pip install pycaret-ts-alpha -U"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Requirement already satisfied: pycaret-ts-alpha in /usr/local/lib/python3.7/dist-packages (3.0.0.dev1635609350)\n",
"Requirement already satisfied: gensim<4.0.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (3.6.0)\n",
"Requirement already satisfied: scikit-learn~=0.24.2 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.24.2)\n",
"Requirement already satisfied: textblob in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.15.3)\n",
"Requirement already satisfied: lightgbm>=2.3.1 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (3.3.1)\n",
"Requirement already satisfied: wordcloud in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.5.0)\n",
"Requirement already satisfied: mlflow in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.21.0)\n",
"Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (3.2.2)\n",
"Requirement already satisfied: cufflinks>=0.17.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.17.3)\n",
"Requirement already satisfied: scipy<=1.5.4 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.5.4)\n",
"Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.1.5)\n",
"Requirement already satisfied: scikit-plot in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.3.7)\n",
"Requirement already satisfied: pyLDAvis in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (3.2.2)\n",
"Requirement already satisfied: IPython in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (5.5.0)\n",
"Requirement already satisfied: numba in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.54.1)\n",
"Requirement already satisfied: pyod in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.9.5)\n",
"Requirement already satisfied: plotly>=5.0.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (5.3.1)\n",
"Requirement already satisfied: Boruta in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.3)\n",
"Requirement already satisfied: mlxtend>=0.17.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.19.0)\n",
"Requirement already satisfied: pmdarima>=1.8.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.8.3)\n",
"Requirement already satisfied: yellowbrick>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.3.post1)\n",
"Requirement already satisfied: seaborn in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.11.2)\n",
"Requirement already satisfied: ipywidgets in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (7.6.5)\n",
"Requirement already satisfied: imbalanced-learn==0.7.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.7.0)\n",
"Requirement already satisfied: spacy<2.4.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (2.2.4)\n",
"Requirement already satisfied: sktime>=0.8.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.8.1)\n",
"Requirement already satisfied: tbats>=1.1.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.1.0)\n",
"Requirement already satisfied: nltk in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (3.2.5)\n",
"Requirement already satisfied: statsmodels~=0.12.1 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.12.1)\n",
"Requirement already satisfied: numpy==1.19.5 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.19.5)\n",
"Requirement already satisfied: pyyaml<6.0.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (5.4.1)\n",
"Requirement already satisfied: kmodes>=0.10.1 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.11.1)\n",
"Requirement already satisfied: pandas-profiling>=2.8.0 in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (3.1.0)\n",
"Requirement already satisfied: umap-learn in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (0.5.2)\n",
"Requirement already satisfied: joblib in /usr/local/lib/python3.7/dist-packages (from pycaret-ts-alpha) (1.0.1)\n",
"Requirement already satisfied: colorlover>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from cufflinks>=0.17.0->pycaret-ts-alpha) (0.3.0)\n",
"Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.7/dist-packages (from cufflinks>=0.17.0->pycaret-ts-alpha) (1.15.0)\n",
"Requirement already satisfied: setuptools>=34.4.1 in /usr/local/lib/python3.7/dist-packages (from cufflinks>=0.17.0->pycaret-ts-alpha) (57.4.0)\n",
"Requirement already satisfied: smart-open>=1.2.1 in /usr/local/lib/python3.7/dist-packages (from gensim<4.0.0->pycaret-ts-alpha) (5.2.1)\n",
"Requirement already satisfied: pexpect in /usr/local/lib/python3.7/dist-packages (from IPython->pycaret-ts-alpha) (4.8.0)\n",
"Requirement already satisfied: simplegeneric>0.8 in /usr/local/lib/python3.7/dist-packages (from IPython->pycaret-ts-alpha) (0.8.1)\n",
"Requirement already satisfied: pygments in /usr/local/lib/python3.7/dist-packages (from IPython->pycaret-ts-alpha) (2.6.1)\n",
"Requirement already satisfied: decorator in /usr/local/lib/python3.7/dist-packages (from IPython->pycaret-ts-alpha) (4.4.2)\n",
"Requirement already satisfied: pickleshare in /usr/local/lib/python3.7/dist-packages (from IPython->pycaret-ts-alpha) (0.7.5)\n",
"Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /usr/local/lib/python3.7/dist-packages (from IPython->pycaret-ts-alpha) (1.0.18)\n",
"Requirement already satisfied: traitlets>=4.2 in /usr/local/lib/python3.7/dist-packages (from IPython->pycaret-ts-alpha) (5.1.0)\n",
"Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->pycaret-ts-alpha) (1.0.2)\n",
"Requirement already satisfied: widgetsnbextension~=3.5.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->pycaret-ts-alpha) (3.5.1)\n",
"Requirement already satisfied: nbformat>=4.2.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->pycaret-ts-alpha) (5.1.3)\n",
"Requirement already satisfied: ipython-genutils~=0.2.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->pycaret-ts-alpha) (0.2.0)\n",
"Requirement already satisfied: ipykernel>=4.5.1 in /usr/local/lib/python3.7/dist-packages (from ipywidgets->pycaret-ts-alpha) (4.10.1)\n",
"Requirement already satisfied: tornado>=4.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel>=4.5.1->ipywidgets->pycaret-ts-alpha) (5.1.1)\n",
"Requirement already satisfied: jupyter-client in /usr/local/lib/python3.7/dist-packages (from ipykernel>=4.5.1->ipywidgets->pycaret-ts-alpha) (5.3.5)\n",
"Requirement already satisfied: wheel in /usr/local/lib/python3.7/dist-packages (from lightgbm>=2.3.1->pycaret-ts-alpha) (0.37.0)\n",
"Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pycaret-ts-alpha) (2.8.2)\n",
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pycaret-ts-alpha) (2.4.7)\n",
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pycaret-ts-alpha) (0.10.0)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->pycaret-ts-alpha) (1.3.2)\n",
"Requirement already satisfied: jupyter-core in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets->pycaret-ts-alpha) (4.8.1)\n",
"Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets->pycaret-ts-alpha) (2.6.0)\n",
"Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas->pycaret-ts-alpha) (2018.9)\n",
"Requirement already satisfied: missingno>=0.4.2 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (0.5.0)\n",
"Requirement already satisfied: jinja2>=2.11.1 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (2.11.3)\n",
"Requirement already satisfied: phik>=0.11.1 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (0.12.0)\n",
"Requirement already satisfied: pydantic>=1.8.1 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (1.8.2)\n",
"Requirement already satisfied: tqdm>=4.48.2 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (4.62.3)\n",
"Requirement already satisfied: htmlmin>=0.1.12 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (0.1.12)\n",
"Requirement already satisfied: visions[type_image_path]==0.7.4 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (0.7.4)\n",
"Requirement already satisfied: requests>=2.24.0 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (2.26.0)\n",
"Requirement already satisfied: multimethod>=1.4 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (1.6)\n",
"Requirement already satisfied: tangled-up-in-unicode==0.1.0 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (0.1.0)\n",
"Requirement already satisfied: markupsafe~=2.0.1 in /usr/local/lib/python3.7/dist-packages (from pandas-profiling>=2.8.0->pycaret-ts-alpha) (2.0.1)\n",
"Requirement already satisfied: networkx>=2.4 in /usr/local/lib/python3.7/dist-packages (from visions[type_image_path]==0.7.4->pandas-profiling>=2.8.0->pycaret-ts-alpha) (2.6.3)\n",
"Requirement already satisfied: attrs>=19.3.0 in /usr/local/lib/python3.7/dist-packages (from visions[type_image_path]==0.7.4->pandas-profiling>=2.8.0->pycaret-ts-alpha) (21.2.0)\n",
"Requirement already satisfied: imagehash in /usr/local/lib/python3.7/dist-packages (from visions[type_image_path]==0.7.4->pandas-profiling>=2.8.0->pycaret-ts-alpha) (4.2.1)\n",
"Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from visions[type_image_path]==0.7.4->pandas-profiling>=2.8.0->pycaret-ts-alpha) (7.1.2)\n",
"Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.7/dist-packages (from plotly>=5.0.0->pycaret-ts-alpha) (8.0.1)\n",
"Requirement already satisfied: urllib3 in /usr/local/lib/python3.7/dist-packages (from pmdarima>=1.8.0->pycaret-ts-alpha) (1.24.3)\n",
"Requirement already satisfied: Cython!=0.29.18,>=0.29 in /usr/local/lib/python3.7/dist-packages (from pmdarima>=1.8.0->pycaret-ts-alpha) (0.29.24)\n",
"Requirement already satisfied: wcwidth in /usr/local/lib/python3.7/dist-packages (from prompt-toolkit<2.0.0,>=1.0.4->IPython->pycaret-ts-alpha) (0.2.5)\n",
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.7/dist-packages (from pydantic>=1.8.1->pandas-profiling>=2.8.0->pycaret-ts-alpha) (3.7.4.3)\n",
"Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.7/dist-packages (from requests>=2.24.0->pandas-profiling>=2.8.0->pycaret-ts-alpha) (2.0.7)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests>=2.24.0->pandas-profiling>=2.8.0->pycaret-ts-alpha) (2021.5.30)\n",
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests>=2.24.0->pandas-profiling>=2.8.0->pycaret-ts-alpha) (2.10)\n",
"Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn~=0.24.2->pycaret-ts-alpha) (3.0.0)\n",
"Requirement already satisfied: llvmlite<0.38,>=0.37.0rc1 in /usr/local/lib/python3.7/dist-packages (from numba->pycaret-ts-alpha) (0.37.0)\n",
"Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (3.0.5)\n",
"Requirement already satisfied: blis<0.5.0,>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (0.4.1)\n",
"Requirement already satisfied: srsly<1.1.0,>=1.0.2 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (1.0.5)\n",
"Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (1.0.0)\n",
"Requirement already satisfied: thinc==7.4.0 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (7.4.0)\n",
"Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (2.0.5)\n",
"Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (1.0.5)\n",
"Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (0.8.2)\n",
"Requirement already satisfied: plac<1.2.0,>=0.9.6 in /usr/local/lib/python3.7/dist-packages (from spacy<2.4.0->pycaret-ts-alpha) (1.1.3)\n",
"Requirement already satisfied: importlib-metadata>=0.20 in /usr/local/lib/python3.7/dist-packages (from catalogue<1.1.0,>=0.0.7->spacy<2.4.0->pycaret-ts-alpha) (4.8.1)\n",
"Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=0.20->catalogue<1.1.0,>=0.0.7->spacy<2.4.0->pycaret-ts-alpha) (3.6.0)\n",
"Requirement already satisfied: patsy>=0.5 in /usr/local/lib/python3.7/dist-packages (from statsmodels~=0.12.1->pycaret-ts-alpha) (0.5.2)\n",
"Requirement already satisfied: notebook>=4.4.1 in /usr/local/lib/python3.7/dist-packages (from widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (5.3.1)\n",
"Requirement already satisfied: Send2Trash in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (1.8.0)\n",
"Requirement already satisfied: nbconvert in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (5.6.1)\n",
"Requirement already satisfied: terminado>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (0.12.1)\n",
"Requirement already satisfied: pyzmq>=13 in /usr/local/lib/python3.7/dist-packages (from jupyter-client->ipykernel>=4.5.1->ipywidgets->pycaret-ts-alpha) (22.3.0)\n",
"Requirement already satisfied: ptyprocess in /usr/local/lib/python3.7/dist-packages (from terminado>=0.8.1->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (0.7.0)\n",
"Requirement already satisfied: PyWavelets in /usr/local/lib/python3.7/dist-packages (from imagehash->visions[type_image_path]==0.7.4->pandas-profiling>=2.8.0->pycaret-ts-alpha) (1.1.1)\n",
"Requirement already satisfied: cloudpickle in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (1.3.0)\n",
"Requirement already satisfied: gunicorn in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (20.1.0)\n",
"Requirement already satisfied: querystring-parser in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (1.2.4)\n",
"Requirement already satisfied: docker>=4.0.0 in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (5.0.3)\n",
"Requirement already satisfied: databricks-cli>=0.8.7 in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (0.16.2)\n",
"Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (7.1.2)\n",
"Requirement already satisfied: protobuf>=3.7.0 in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (3.17.3)\n",
"Requirement already satisfied: sqlalchemy in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (1.4.25)\n",
"Requirement already satisfied: entrypoints in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (0.3)\n",
"Requirement already satisfied: prometheus-flask-exporter in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (0.18.5)\n",
"Requirement already satisfied: Flask in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (1.1.4)\n",
"Requirement already satisfied: sqlparse>=0.3.1 in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (0.4.2)\n",
"Requirement already satisfied: alembic<=1.4.1 in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (1.4.1)\n",
"Requirement already satisfied: gitpython>=2.1.0 in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (3.1.24)\n",
"Requirement already satisfied: packaging in /usr/local/lib/python3.7/dist-packages (from mlflow->pycaret-ts-alpha) (21.0)\n",
"Requirement already satisfied: python-editor>=0.3 in /usr/local/lib/python3.7/dist-packages (from alembic<=1.4.1->mlflow->pycaret-ts-alpha) (1.0.4)\n",
"Requirement already satisfied: Mako in /usr/local/lib/python3.7/dist-packages (from alembic<=1.4.1->mlflow->pycaret-ts-alpha) (1.1.5)\n",
"Requirement already satisfied: tabulate>=0.7.7 in /usr/local/lib/python3.7/dist-packages (from databricks-cli>=0.8.7->mlflow->pycaret-ts-alpha) (0.8.9)\n",
"Requirement already satisfied: websocket-client>=0.32.0 in /usr/local/lib/python3.7/dist-packages (from docker>=4.0.0->mlflow->pycaret-ts-alpha) (1.2.1)\n",
"Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.7/dist-packages (from gitpython>=2.1.0->mlflow->pycaret-ts-alpha) (4.0.9)\n",
"Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.7/dist-packages (from gitdb<5,>=4.0.1->gitpython>=2.1.0->mlflow->pycaret-ts-alpha) (5.0.0)\n",
"Requirement already satisfied: greenlet!=0.4.17 in /usr/local/lib/python3.7/dist-packages (from sqlalchemy->mlflow->pycaret-ts-alpha) (1.1.2)\n",
"Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from Flask->mlflow->pycaret-ts-alpha) (1.1.0)\n",
"Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from Flask->mlflow->pycaret-ts-alpha) (1.0.1)\n",
"Requirement already satisfied: bleach in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (4.1.0)\n",
"Requirement already satisfied: testpath in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (0.5.0)\n",
"Requirement already satisfied: defusedxml in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (0.7.1)\n",
"Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (1.5.0)\n",
"Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (0.8.4)\n",
"Requirement already satisfied: webencodings in /usr/local/lib/python3.7/dist-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret-ts-alpha) (0.5.1)\n",
"Requirement already satisfied: prometheus-client in /usr/local/lib/python3.7/dist-packages (from prometheus-flask-exporter->mlflow->pycaret-ts-alpha) (0.11.0)\n",
"Requirement already satisfied: funcy in /usr/local/lib/python3.7/dist-packages (from pyLDAvis->pycaret-ts-alpha) (1.16)\n",
"Requirement already satisfied: numexpr in /usr/local/lib/python3.7/dist-packages (from pyLDAvis->pycaret-ts-alpha) (2.7.3)\n",
"Requirement already satisfied: future in /usr/local/lib/python3.7/dist-packages (from pyLDAvis->pycaret-ts-alpha) (0.16.0)\n",
"Requirement already satisfied: pynndescent>=0.5 in /usr/local/lib/python3.7/dist-packages (from umap-learn->pycaret-ts-alpha) (0.5.5)\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 146
},
"id": "G91sw_lDJiOM",
"outputId": "fe6fd4ec-43d8-40b0-c577-2f038819cf7e"
},
"source": [
"#### Load data ----\n",
"from pycaret.datasets import get_data\n",
"y = get_data(\"airline\")"
],
"execution_count": 2,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Period\n",
"1949-01 112.0\n",
"1949-02 118.0\n",
"1949-03 132.0\n",
"1949-04 129.0\n",
"1949-05 121.0\n",
"Freq: M, Name: Number of airline passengers, dtype: float64"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 695,
"referenced_widgets": [
"adb7060989e84bf79d76f0621182ceff",
"35f925cd2a224a2a95cd9e920ea2ec70",
"e15c83c8b9984d3c825b86faf5267ddc"
]
},
"id": "_j18fGv6KNXw",
"outputId": "924466a8-dee8-4eb4-d507-b399b60bfc86"
},
"source": [
"#### Setup experiment ----\n",
"from pycaret.internal.pycaret_experiment.time_series_experiment import TimeSeriesExperiment\n",
"exp = TimeSeriesExperiment()\n",
"\n",
"exp.setup(data=y, fh=12, session_id=42) "
],
"execution_count": 3,
"outputs": [
{
"output_type": "display_data",
"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>Description</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>session_id</td>\n",
" <td>42</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Original Data</td>\n",
" <td>(144, 1)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Missing Values</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Transformed Train Set</td>\n",
" <td>(132,)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Transformed Test Set</td>\n",
" <td>(12,)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Fold Generator</td>\n",
" <td>ExpandingWindowSplitter</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Fold Number</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Enforce Prediction Interval</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Seasonal Period Tested</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Seasonality Detected</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>Target Strictly Positive</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>Target White Noise</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>Recommended d</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>Recommended Seasonal D</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>CPU Jobs</td>\n",
" <td>-1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>Use GPU</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>Log Experiment</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>Experiment Name</td>\n",
" <td>ts-default-name</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>USI</td>\n",
" <td>2cca</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>Imputation Type</td>\n",
" <td>simple</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Description Value\n",
"0 session_id 42\n",
"1 Original Data (144, 1)\n",
"2 Missing Values False\n",
"3 Transformed Train Set (132,)\n",
"4 Transformed Test Set (12,)\n",
"5 Fold Generator ExpandingWindowSplitter\n",
"6 Fold Number 3\n",
"7 Enforce Prediction Interval False\n",
"8 Seasonal Period Tested 12\n",
"9 Seasonality Detected True\n",
"10 Target Strictly Positive True\n",
"11 Target White Noise No\n",
"12 Recommended d 1\n",
"13 Recommended Seasonal D 1\n",
"14 CPU Jobs -1\n",
"15 Use GPU False\n",
"16 Log Experiment False\n",
"17 Experiment Name ts-default-name\n",
"18 USI 2cca\n",
"19 Imputation Type simple"
]
},
"metadata": {}
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<pycaret.internal.pycaret_experiment.time_series_experiment.TimeSeriesExperiment at 0x7f6d3b61d910>"
]
},
"metadata": {},
"execution_count": 3
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XFBU8y4K2EeJ"
},
"source": [
"# Part 1: Basic Tuning\n",
"\n",
"## Baseline Model"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 731,
"referenced_widgets": [
"2984e020d89f4e39a09d7a5284e07fac",
"e61e651987f34f13a13ea321fec44665",
"7cb79b7251c6401f9536ee6ee84cd92b"
]
},
"id": "PNOu9y8zJwa2",
"outputId": "5427149c-b922-4d3b-b0de-7443403fac03"
},
"source": [
"model = exp.create_model(\"lr_cds_dt\")\n",
"exp.plot_model(model)"
],
"execution_count": 4,
"outputs": [
{
"output_type": "display_data",
"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>cutoff</th>\n",
" <th>MAE</th>\n",
" <th>RMSE</th>\n",
" <th>MAPE</th>\n",
" <th>SMAPE</th>\n",
" <th>R2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1956-12</td>\n",
" <td>38.6824</td>\n",
" <td>45.0820</td>\n",
" <td>0.0998</td>\n",
" <td>0.1051</td>\n",
" <td>0.3384</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1957-12</td>\n",
" <td>28.0608</td>\n",
" <td>34.6867</td>\n",
" <td>0.0751</td>\n",
" <td>0.0734</td>\n",
" <td>0.6848</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1958-12</td>\n",
" <td>32.1693</td>\n",
" <td>38.2681</td>\n",
" <td>0.0737</td>\n",
" <td>0.0753</td>\n",
" <td>0.6724</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Mean</th>\n",
" <td>NaN</td>\n",
" <td>32.9708</td>\n",
" <td>39.3456</td>\n",
" <td>0.0828</td>\n",
" <td>0.0846</td>\n",
" <td>0.5652</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SD</th>\n",
" <td>NaN</td>\n",
" <td>4.3731</td>\n",
" <td>4.3117</td>\n",
" <td>0.0120</td>\n",
" <td>0.0145</td>\n",
" <td>0.1604</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cutoff MAE RMSE MAPE SMAPE R2\n",
"0 1956-12 38.6824 45.0820 0.0998 0.1051 0.3384\n",
"1 1957-12 28.0608 34.6867 0.0751 0.0734 0.6848\n",
"2 1958-12 32.1693 38.2681 0.0737 0.0753 0.6724\n",
"Mean NaN 32.9708 39.3456 0.0828 0.0846 0.5652\n",
"SD NaN 4.3731 4.3117 0.0120 0.0145 0.1604"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": [
"<html>\n",
"<head><meta charset=\"utf-8\" /></head>\n",
"<body>\n",
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
" <script src=\"https://cdn.plot.ly/plotly-2.4.2.min.js\"></script> <div id=\"c8280598-a779-43ba-a904-88f04fcb6d76\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"c8280598-a779-43ba-a904-88f04fcb6d76\")) { Plotly.newPlot( \"c8280598-a779-43ba-a904-88f04fcb6d76\", [{\"line\":{\"color\":\"#1f77b4\"},\"marker\":{\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Forecast | LinearRegression\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[433.1925,414.247,394.9755,374.2084,431.222,493.9331,527.8974,512.4796,456.4409,436.8202,439.085,460.367]},{\"marker\":{\"color\":\"#3f3f3f\",\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Original\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1949-01-01T00:00:00\",\"1949-02-01T00:00:00\",\"1949-03-01T00:00:00\",\"1949-04-01T00:00:00\",\"1949-05-01T00:00:00\",\"1949-06-01T00:00:00\",\"1949-07-01T00:00:00\",\"1949-08-01T00:00:00\",\"1949-09-01T00:00:00\",\"1949-10-01T00:00:00\",\"1949-11-01T00:00:00\",\"1949-12-01T00:00:00\",\"1950-01-01T00:00:00\",\"1950-02-01T00:00:00\",\"1950-03-01T00:00:00\",\"1950-04-01T00:00:00\",\"1950-05-01T00:00:00\",\"1950-06-01T00:00:00\",\"1950-07-01T00:00:00\",\"1950-08-01T00:00:00\",\"1950-09-01T00:00:00\",\"1950-10-01T00:00:00\",\"1950-11-01T00:00:00\",\"1950-12-01T00:00:00\",\"1951-01-01T00:00:00\",\"1951-02-01T00:00:00\",\"1951-03-01T00:00:00\",\"1951-04-01T00:00:00\",\"1951-05-01T00:00:00\",\"1951-06-01T00:00:00\",\"1951-07-01T00:00:00\",\"1951-08-01T00:00:00\",\"1951-09-01T00:00:00\",\"1951-10-01T00:00:00\",\"1951-11-01T00:00:00\",\"1951-12-01T00:00:00\",\"1952-01-01T00:00:00\",\"1952-02-01T00:00:00\",\"1952-03-01T00:00:00\",\"1952-04-01T00:00:00\",\"1952-05-01T00:00:00\",\"1952-06-01T00:00:00\",\"1952-07-01T00:00:00\",\"1952-08-01T00:00:00\",\"1952-09-01T00:00:00\",\"1952-10-01T00:00:00\",\"1952-11-01T00:00:00\",\"1952-12-01T00:00:00\",\"1953-01-01T00:00:00\",\"1953-02-01T00:00:00\",\"1953-03-01T00:00:00\",\"1953-04-01T00:00:00\",\"1953-05-01T00:00:00\",\"1953-06-01T00:00:00\",\"1953-07-01T00:00:00\",\"1953-08-01T00:00:00\",\"1953-09-01T00:00:00\",\"1953-10-01T00:00:00\",\"1953-11-01T00:00:00\",\"1953-12-01T00:00:00\",\"1954-01-01T00:00:00\",\"1954-02-01T00:00:00\",\"1954-03-01T00:00:00\",\"1954-04-01T00:00:00\",\"1954-05-01T00:00:00\",\"1954-06-01T00:00:00\",\"1954-07-01T00:00:00\",\"1954-08-01T00:00:00\",\"1954-09-01T00:00:00\",\"1954-10-01T00:00:00\",\"1954-11-01T00:00:00\",\"1954-12-01T00:00:00\",\"1955-01-01T00:00:00\",\"1955-02-01T00:00:00\",\"1955-03-01T00:00:00\",\"1955-04-01T00:00:00\",\"1955-05-01T00:00:00\",\"1955-06-01T00:00:00\",\"1955-07-01T00:00:00\",\"1955-08-01T00:00:00\",\"1955-09-01T00:00:00\",\"1955-10-01T00:00:00\",\"1955-11-01T00:00:00\",\"1955-12-01T00:00:00\",\"1956-01-01T00:00:00\",\"1956-02-01T00:00:00\",\"1956-03-01T00:00:00\",\"1956-04-01T00:00:00\",\"1956-05-01T00:00:00\",\"1956-06-01T00:00:00\",\"1956-07-01T00:00:00\",\"1956-08-01T00:00:00\",\"1956-09-01T00:00:00\",\"1956-10-01T00:00:00\",\"1956-11-01T00:00:00\",\"1956-12-01T00:00:00\",\"1957-01-01T00:00:00\",\"1957-02-01T00:00:00\",\"1957-03-01T00:00:00\",\"1957-04-01T00:00:00\",\"1957-05-01T00:00:00\",\"1957-06-01T00:00:00\",\"1957-07-01T00:00:00\",\"1957-08-01T00:00:00\",\"1957-09-01T00:00:00\",\"1957-10-01T00:00:00\",\"1957-11-01T00:00:00\",\"1957-12-01T00:00:00\",\"1958-01-01T00:00:00\",\"1958-02-01T00:00:00\",\"1958-03-01T00:00:00\",\"1958-04-01T00:00:00\",\"1958-05-01T00:00:00\",\"1958-06-01T00:00:00\",\"1958-07-01T00:00:00\",\"1958-08-01T00:00:00\",\"1958-09-01T00:00:00\",\"1958-10-01T00:00:00\",\"1958-11-01T00:00:00\",\"1958-12-01T00:00:00\",\"1959-01-01T00:00:00\",\"1959-02-01T00:00:00\",\"1959-03-01T00:00:00\",\"1959-04-01T00:00:00\",\"1959-05-01T00:00:00\",\"1959-06-01T00:00:00\",\"1959-07-01T00:00:00\",\"1959-08-01T00:00:00\",\"1959-09-01T00:00:00\",\"1959-10-01T00:00:00\",\"1959-11-01T00:00:00\",\"1959-12-01T00:00:00\",\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[112.0,118.0,132.0,129.0,121.0,135.0,148.0,148.0,136.0,119.0,104.0,118.0,115.0,126.0,141.0,135.0,125.0,149.0,170.0,170.0,158.0,133.0,114.0,140.0,145.0,150.0,178.0,163.0,172.0,178.0,199.0,199.0,184.0,162.0,146.0,166.0,171.0,180.0,193.0,181.0,183.0,218.0,230.0,242.0,209.0,191.0,172.0,194.0,196.0,196.0,236.0,235.0,229.0,243.0,264.0,272.0,237.0,211.0,180.0,201.0,204.0,188.0,235.0,227.0,234.0,264.0,302.0,293.0,259.0,229.0,203.0,229.0,242.0,233.0,267.0,269.0,270.0,315.0,364.0,347.0,312.0,274.0,237.0,278.0,284.0,277.0,317.0,313.0,318.0,374.0,413.0,405.0,355.0,306.0,271.0,306.0,315.0,301.0,356.0,348.0,355.0,422.0,465.0,467.0,404.0,347.0,305.0,336.0,340.0,318.0,362.0,348.0,363.0,435.0,491.0,505.0,404.0,359.0,310.0,337.0,360.0,342.0,406.0,396.0,420.0,472.0,548.0,559.0,463.0,407.0,362.0,405.0,417.0,391.0,419.0,461.0,472.0,535.0,622.0,606.0,508.0,461.0,390.0,432.0]}], {\"showlegend\":true,\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"rgb(51,51,51)\"},\"error_y\":{\"color\":\"rgb(51,51,51)\"},\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"baxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"rgb(237,237,237)\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"rgb(217,217,217)\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"colorscale\":{\"sequential\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"sequentialminus\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]]},\"colorway\":[\"#F8766D\",\"#A3A500\",\"#00BF7D\",\"#00B0F6\",\"#E76BF3\"],\"font\":{\"color\":\"rgb(51,51,51)\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"rgb(237,237,237)\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"rgb(237,237,237)\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"fillcolor\":\"black\",\"line\":{\"width\":0},\"opacity\":0.3},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"}}},\"title\":{\"text\":\"Actual vs. Forecast | Number of airline passengers\"},\"xaxis\":{\"title\":{\"text\":\"Time\"}},\"yaxis\":{\"title\":{\"text\":\"Values\"}}}, {\"responsive\": true} ).then(function(){\n",
" \n",
"var gd = document.getElementById('c8280598-a779-43ba-a904-88f04fcb6d76');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; </script> </div>\n",
"</body>\n",
"</html>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "bjD1dtfOO0CN",
"outputId": "2da1711e-1f1d-4d86-d7ab-a9985784cf36"
},
"source": [
"#### What are the model hyperparameters? ----\n",
"model"
],
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"BaseCdsDtForecaster(degree=1, deseasonal_model='additive',\n",
" regressor=LinearRegression(copy_X=True, fit_intercept=True,\n",
" n_jobs=-1, normalize=False,\n",
" positive=False),\n",
" sp=1, window_length=10)"
]
},
"metadata": {},
"execution_count": 5
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "-alpo8Td2HRo"
},
"source": [
"## Randon Grid Search"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 731,
"referenced_widgets": [
"7e657717877a499383df0f51936647ce",
"cf653223634b42dbb7da06d44ca1be55",
"56b1213809724f369fbe12dec92eb755"
]
},
"id": "2iqFHDigedfa",
"outputId": "444a5b26-455f-485a-e530-caca1636a5a6"
},
"source": [
"#### Tune the model (Default = Random Grid Search) ----\n",
"tuned_model_random = exp.tune_model(model)\n",
"exp.plot_model(tuned_model_random)"
],
"execution_count": 6,
"outputs": [
{
"output_type": "display_data",
"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>cutoff</th>\n",
" <th>MAE</th>\n",
" <th>RMSE</th>\n",
" <th>MAPE</th>\n",
" <th>SMAPE</th>\n",
" <th>R2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1956-12</td>\n",
" <td>9.2184</td>\n",
" <td>12.1077</td>\n",
" <td>0.0233</td>\n",
" <td>0.0235</td>\n",
" <td>0.9523</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1957-12</td>\n",
" <td>30.6011</td>\n",
" <td>33.3898</td>\n",
" <td>0.0834</td>\n",
" <td>0.0794</td>\n",
" <td>0.7079</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1958-12</td>\n",
" <td>13.6786</td>\n",
" <td>15.8682</td>\n",
" <td>0.0320</td>\n",
" <td>0.0325</td>\n",
" <td>0.9437</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Mean</th>\n",
" <td>NaN</td>\n",
" <td>17.8327</td>\n",
" <td>20.4552</td>\n",
" <td>0.0462</td>\n",
" <td>0.0452</td>\n",
" <td>0.8680</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SD</th>\n",
" <td>NaN</td>\n",
" <td>9.2104</td>\n",
" <td>9.2741</td>\n",
" <td>0.0265</td>\n",
" <td>0.0245</td>\n",
" <td>0.1132</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cutoff MAE RMSE MAPE SMAPE R2\n",
"0 1956-12 9.2184 12.1077 0.0233 0.0235 0.9523\n",
"1 1957-12 30.6011 33.3898 0.0834 0.0794 0.7079\n",
"2 1958-12 13.6786 15.8682 0.0320 0.0325 0.9437\n",
"Mean NaN 17.8327 20.4552 0.0462 0.0452 0.8680\n",
"SD NaN 9.2104 9.2741 0.0265 0.0245 0.1132"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": [
"<html>\n",
"<head><meta charset=\"utf-8\" /></head>\n",
"<body>\n",
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
" <script src=\"https://cdn.plot.ly/plotly-2.4.2.min.js\"></script> <div id=\"c275a401-d1ba-4b93-9d94-aa99dcc5b8a7\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"c275a401-d1ba-4b93-9d94-aa99dcc5b8a7\")) { Plotly.newPlot( \"c275a401-d1ba-4b93-9d94-aa99dcc5b8a7\", [{\"line\":{\"color\":\"#1f77b4\"},\"marker\":{\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Forecast | LinearRegression\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[422.6179,414.2555,467.3749,452.2561,469.6182,531.5593,602.7152,612.1104,520.8076,457.7524,393.5735,442.2627]},{\"marker\":{\"color\":\"#3f3f3f\",\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Original\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1949-01-01T00:00:00\",\"1949-02-01T00:00:00\",\"1949-03-01T00:00:00\",\"1949-04-01T00:00:00\",\"1949-05-01T00:00:00\",\"1949-06-01T00:00:00\",\"1949-07-01T00:00:00\",\"1949-08-01T00:00:00\",\"1949-09-01T00:00:00\",\"1949-10-01T00:00:00\",\"1949-11-01T00:00:00\",\"1949-12-01T00:00:00\",\"1950-01-01T00:00:00\",\"1950-02-01T00:00:00\",\"1950-03-01T00:00:00\",\"1950-04-01T00:00:00\",\"1950-05-01T00:00:00\",\"1950-06-01T00:00:00\",\"1950-07-01T00:00:00\",\"1950-08-01T00:00:00\",\"1950-09-01T00:00:00\",\"1950-10-01T00:00:00\",\"1950-11-01T00:00:00\",\"1950-12-01T00:00:00\",\"1951-01-01T00:00:00\",\"1951-02-01T00:00:00\",\"1951-03-01T00:00:00\",\"1951-04-01T00:00:00\",\"1951-05-01T00:00:00\",\"1951-06-01T00:00:00\",\"1951-07-01T00:00:00\",\"1951-08-01T00:00:00\",\"1951-09-01T00:00:00\",\"1951-10-01T00:00:00\",\"1951-11-01T00:00:00\",\"1951-12-01T00:00:00\",\"1952-01-01T00:00:00\",\"1952-02-01T00:00:00\",\"1952-03-01T00:00:00\",\"1952-04-01T00:00:00\",\"1952-05-01T00:00:00\",\"1952-06-01T00:00:00\",\"1952-07-01T00:00:00\",\"1952-08-01T00:00:00\",\"1952-09-01T00:00:00\",\"1952-10-01T00:00:00\",\"1952-11-01T00:00:00\",\"1952-12-01T00:00:00\",\"1953-01-01T00:00:00\",\"1953-02-01T00:00:00\",\"1953-03-01T00:00:00\",\"1953-04-01T00:00:00\",\"1953-05-01T00:00:00\",\"1953-06-01T00:00:00\",\"1953-07-01T00:00:00\",\"1953-08-01T00:00:00\",\"1953-09-01T00:00:00\",\"1953-10-01T00:00:00\",\"1953-11-01T00:00:00\",\"1953-12-01T00:00:00\",\"1954-01-01T00:00:00\",\"1954-02-01T00:00:00\",\"1954-03-01T00:00:00\",\"1954-04-01T00:00:00\",\"1954-05-01T00:00:00\",\"1954-06-01T00:00:00\",\"1954-07-01T00:00:00\",\"1954-08-01T00:00:00\",\"1954-09-01T00:00:00\",\"1954-10-01T00:00:00\",\"1954-11-01T00:00:00\",\"1954-12-01T00:00:00\",\"1955-01-01T00:00:00\",\"1955-02-01T00:00:00\",\"1955-03-01T00:00:00\",\"1955-04-01T00:00:00\",\"1955-05-01T00:00:00\",\"1955-06-01T00:00:00\",\"1955-07-01T00:00:00\",\"1955-08-01T00:00:00\",\"1955-09-01T00:00:00\",\"1955-10-01T00:00:00\",\"1955-11-01T00:00:00\",\"1955-12-01T00:00:00\",\"1956-01-01T00:00:00\",\"1956-02-01T00:00:00\",\"1956-03-01T00:00:00\",\"1956-04-01T00:00:00\",\"1956-05-01T00:00:00\",\"1956-06-01T00:00:00\",\"1956-07-01T00:00:00\",\"1956-08-01T00:00:00\",\"1956-09-01T00:00:00\",\"1956-10-01T00:00:00\",\"1956-11-01T00:00:00\",\"1956-12-01T00:00:00\",\"1957-01-01T00:00:00\",\"1957-02-01T00:00:00\",\"1957-03-01T00:00:00\",\"1957-04-01T00:00:00\",\"1957-05-01T00:00:00\",\"1957-06-01T00:00:00\",\"1957-07-01T00:00:00\",\"1957-08-01T00:00:00\",\"1957-09-01T00:00:00\",\"1957-10-01T00:00:00\",\"1957-11-01T00:00:00\",\"1957-12-01T00:00:00\",\"1958-01-01T00:00:00\",\"1958-02-01T00:00:00\",\"1958-03-01T00:00:00\",\"1958-04-01T00:00:00\",\"1958-05-01T00:00:00\",\"1958-06-01T00:00:00\",\"1958-07-01T00:00:00\",\"1958-08-01T00:00:00\",\"1958-09-01T00:00:00\",\"1958-10-01T00:00:00\",\"1958-11-01T00:00:00\",\"1958-12-01T00:00:00\",\"1959-01-01T00:00:00\",\"1959-02-01T00:00:00\",\"1959-03-01T00:00:00\",\"1959-04-01T00:00:00\",\"1959-05-01T00:00:00\",\"1959-06-01T00:00:00\",\"1959-07-01T00:00:00\",\"1959-08-01T00:00:00\",\"1959-09-01T00:00:00\",\"1959-10-01T00:00:00\",\"1959-11-01T00:00:00\",\"1959-12-01T00:00:00\",\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[112.0,118.0,132.0,129.0,121.0,135.0,148.0,148.0,136.0,119.0,104.0,118.0,115.0,126.0,141.0,135.0,125.0,149.0,170.0,170.0,158.0,133.0,114.0,140.0,145.0,150.0,178.0,163.0,172.0,178.0,199.0,199.0,184.0,162.0,146.0,166.0,171.0,180.0,193.0,181.0,183.0,218.0,230.0,242.0,209.0,191.0,172.0,194.0,196.0,196.0,236.0,235.0,229.0,243.0,264.0,272.0,237.0,211.0,180.0,201.0,204.0,188.0,235.0,227.0,234.0,264.0,302.0,293.0,259.0,229.0,203.0,229.0,242.0,233.0,267.0,269.0,270.0,315.0,364.0,347.0,312.0,274.0,237.0,278.0,284.0,277.0,317.0,313.0,318.0,374.0,413.0,405.0,355.0,306.0,271.0,306.0,315.0,301.0,356.0,348.0,355.0,422.0,465.0,467.0,404.0,347.0,305.0,336.0,340.0,318.0,362.0,348.0,363.0,435.0,491.0,505.0,404.0,359.0,310.0,337.0,360.0,342.0,406.0,396.0,420.0,472.0,548.0,559.0,463.0,407.0,362.0,405.0,417.0,391.0,419.0,461.0,472.0,535.0,622.0,606.0,508.0,461.0,390.0,432.0]}], {\"showlegend\":true,\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"rgb(51,51,51)\"},\"error_y\":{\"color\":\"rgb(51,51,51)\"},\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"baxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"rgb(237,237,237)\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"rgb(217,217,217)\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"colorscale\":{\"sequential\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"sequentialminus\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]]},\"colorway\":[\"#F8766D\",\"#A3A500\",\"#00BF7D\",\"#00B0F6\",\"#E76BF3\"],\"font\":{\"color\":\"rgb(51,51,51)\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"rgb(237,237,237)\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"rgb(237,237,237)\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"fillcolor\":\"black\",\"line\":{\"width\":0},\"opacity\":0.3},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"}}},\"title\":{\"text\":\"Actual vs. Forecast | Number of airline passengers\"},\"xaxis\":{\"title\":{\"text\":\"Time\"}},\"yaxis\":{\"title\":{\"text\":\"Values\"}}}, {\"responsive\": true} ).then(function(){\n",
" \n",
"var gd = document.getElementById('c275a401-d1ba-4b93-9d94-aa99dcc5b8a7');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; </script> </div>\n",
"</body>\n",
"</html>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "rOeKvrHh1qTO",
"outputId": "669f2c1a-96b4-4723-8ee6-e73fe02ce325"
},
"source": [
"#### What are the tuned model hyperparameters? ----\n",
"tuned_model_random"
],
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"BaseCdsDtForecaster(degree=2, deseasonal_model='multiplicative',\n",
" regressor=LinearRegression(copy_X=True, fit_intercept=False,\n",
" n_jobs=-1, normalize=True,\n",
" positive=False),\n",
" sp=12, window_length=23)"
]
},
"metadata": {},
"execution_count": 7
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "iwZ41ruRKIOP",
"outputId": "b83a89ad-1928-4ba8-8c4b-ec49ce64a1f9"
},
"source": [
"#### OK, so what search space was used? ----\n",
"random_grid = exp.models(internal=True).loc[\"lr_cds_dt\", \"Tune Distributions\"]\n",
"random_grid"
],
"execution_count": 8,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'degree': IntUniformDistribution(lower=1, upper=10, log=False),\n",
" 'deseasonal_model': CategoricalDistribution(values=['additive', 'multiplicative']),\n",
" 'regressor__fit_intercept': CategoricalDistribution(values=[True, False]),\n",
" 'regressor__normalize': CategoricalDistribution(values=[True, False]),\n",
" 'sp': CategoricalDistribution(values=[12, 24]),\n",
" 'window_length': IntUniformDistribution(lower=12, upper=24, log=False)}"
]
},
"metadata": {},
"execution_count": 8
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "gXfSvkXy2LcB"
},
"source": [
"## Fixed Grid Search"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 731,
"referenced_widgets": [
"119b936a4cfc4961aa7097d917b53a95",
"8b401026306848dd866e3250e4327512",
"e25e1ddd46c74ccbb80caeb79f13ca98"
]
},
"id": "uji1eqvN1KA7",
"outputId": "45d102a9-4c2c-4371-d9e7-aa1f5940b9ee"
},
"source": [
"#### Tune the model (Fixed Grid Search) ----\n",
"tuned_model_grid = exp.tune_model(model, search_algorithm = \"grid\")\n",
"exp.plot_model(tuned_model_grid)"
],
"execution_count": 9,
"outputs": [
{
"output_type": "display_data",
"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>cutoff</th>\n",
" <th>MAE</th>\n",
" <th>RMSE</th>\n",
" <th>MAPE</th>\n",
" <th>SMAPE</th>\n",
" <th>R2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1956-12</td>\n",
" <td>24.0975</td>\n",
" <td>32.7998</td>\n",
" <td>0.0587</td>\n",
" <td>0.0616</td>\n",
" <td>0.6498</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1957-12</td>\n",
" <td>21.7530</td>\n",
" <td>25.4177</td>\n",
" <td>0.0583</td>\n",
" <td>0.0571</td>\n",
" <td>0.8307</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1958-12</td>\n",
" <td>20.5818</td>\n",
" <td>26.9684</td>\n",
" <td>0.0445</td>\n",
" <td>0.0459</td>\n",
" <td>0.8373</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Mean</th>\n",
" <td>NaN</td>\n",
" <td>22.1441</td>\n",
" <td>28.3953</td>\n",
" <td>0.0539</td>\n",
" <td>0.0549</td>\n",
" <td>0.7726</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SD</th>\n",
" <td>NaN</td>\n",
" <td>1.4617</td>\n",
" <td>3.1781</td>\n",
" <td>0.0066</td>\n",
" <td>0.0066</td>\n",
" <td>0.0869</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cutoff MAE RMSE MAPE SMAPE R2\n",
"0 1956-12 24.0975 32.7998 0.0587 0.0616 0.6498\n",
"1 1957-12 21.7530 25.4177 0.0583 0.0571 0.8307\n",
"2 1958-12 20.5818 26.9684 0.0445 0.0459 0.8373\n",
"Mean NaN 22.1441 28.3953 0.0539 0.0549 0.7726\n",
"SD NaN 1.4617 3.1781 0.0066 0.0066 0.0869"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": [
"<html>\n",
"<head><meta charset=\"utf-8\" /></head>\n",
"<body>\n",
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
" <script src=\"https://cdn.plot.ly/plotly-2.4.2.min.js\"></script> <div id=\"f006682d-03fb-413e-9185-0a275a221548\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"f006682d-03fb-413e-9185-0a275a221548\")) { Plotly.newPlot( \"f006682d-03fb-413e-9185-0a275a221548\", [{\"line\":{\"color\":\"#1f77b4\"},\"marker\":{\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Forecast | LinearRegression\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[414.792,404.0568,431.2823,411.498,443.2472,505.1848,544.0845,534.2841,476.2683,436.0239,405.4524,439.5823]},{\"marker\":{\"color\":\"#3f3f3f\",\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Original\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1949-01-01T00:00:00\",\"1949-02-01T00:00:00\",\"1949-03-01T00:00:00\",\"1949-04-01T00:00:00\",\"1949-05-01T00:00:00\",\"1949-06-01T00:00:00\",\"1949-07-01T00:00:00\",\"1949-08-01T00:00:00\",\"1949-09-01T00:00:00\",\"1949-10-01T00:00:00\",\"1949-11-01T00:00:00\",\"1949-12-01T00:00:00\",\"1950-01-01T00:00:00\",\"1950-02-01T00:00:00\",\"1950-03-01T00:00:00\",\"1950-04-01T00:00:00\",\"1950-05-01T00:00:00\",\"1950-06-01T00:00:00\",\"1950-07-01T00:00:00\",\"1950-08-01T00:00:00\",\"1950-09-01T00:00:00\",\"1950-10-01T00:00:00\",\"1950-11-01T00:00:00\",\"1950-12-01T00:00:00\",\"1951-01-01T00:00:00\",\"1951-02-01T00:00:00\",\"1951-03-01T00:00:00\",\"1951-04-01T00:00:00\",\"1951-05-01T00:00:00\",\"1951-06-01T00:00:00\",\"1951-07-01T00:00:00\",\"1951-08-01T00:00:00\",\"1951-09-01T00:00:00\",\"1951-10-01T00:00:00\",\"1951-11-01T00:00:00\",\"1951-12-01T00:00:00\",\"1952-01-01T00:00:00\",\"1952-02-01T00:00:00\",\"1952-03-01T00:00:00\",\"1952-04-01T00:00:00\",\"1952-05-01T00:00:00\",\"1952-06-01T00:00:00\",\"1952-07-01T00:00:00\",\"1952-08-01T00:00:00\",\"1952-09-01T00:00:00\",\"1952-10-01T00:00:00\",\"1952-11-01T00:00:00\",\"1952-12-01T00:00:00\",\"1953-01-01T00:00:00\",\"1953-02-01T00:00:00\",\"1953-03-01T00:00:00\",\"1953-04-01T00:00:00\",\"1953-05-01T00:00:00\",\"1953-06-01T00:00:00\",\"1953-07-01T00:00:00\",\"1953-08-01T00:00:00\",\"1953-09-01T00:00:00\",\"1953-10-01T00:00:00\",\"1953-11-01T00:00:00\",\"1953-12-01T00:00:00\",\"1954-01-01T00:00:00\",\"1954-02-01T00:00:00\",\"1954-03-01T00:00:00\",\"1954-04-01T00:00:00\",\"1954-05-01T00:00:00\",\"1954-06-01T00:00:00\",\"1954-07-01T00:00:00\",\"1954-08-01T00:00:00\",\"1954-09-01T00:00:00\",\"1954-10-01T00:00:00\",\"1954-11-01T00:00:00\",\"1954-12-01T00:00:00\",\"1955-01-01T00:00:00\",\"1955-02-01T00:00:00\",\"1955-03-01T00:00:00\",\"1955-04-01T00:00:00\",\"1955-05-01T00:00:00\",\"1955-06-01T00:00:00\",\"1955-07-01T00:00:00\",\"1955-08-01T00:00:00\",\"1955-09-01T00:00:00\",\"1955-10-01T00:00:00\",\"1955-11-01T00:00:00\",\"1955-12-01T00:00:00\",\"1956-01-01T00:00:00\",\"1956-02-01T00:00:00\",\"1956-03-01T00:00:00\",\"1956-04-01T00:00:00\",\"1956-05-01T00:00:00\",\"1956-06-01T00:00:00\",\"1956-07-01T00:00:00\",\"1956-08-01T00:00:00\",\"1956-09-01T00:00:00\",\"1956-10-01T00:00:00\",\"1956-11-01T00:00:00\",\"1956-12-01T00:00:00\",\"1957-01-01T00:00:00\",\"1957-02-01T00:00:00\",\"1957-03-01T00:00:00\",\"1957-04-01T00:00:00\",\"1957-05-01T00:00:00\",\"1957-06-01T00:00:00\",\"1957-07-01T00:00:00\",\"1957-08-01T00:00:00\",\"1957-09-01T00:00:00\",\"1957-10-01T00:00:00\",\"1957-11-01T00:00:00\",\"1957-12-01T00:00:00\",\"1958-01-01T00:00:00\",\"1958-02-01T00:00:00\",\"1958-03-01T00:00:00\",\"1958-04-01T00:00:00\",\"1958-05-01T00:00:00\",\"1958-06-01T00:00:00\",\"1958-07-01T00:00:00\",\"1958-08-01T00:00:00\",\"1958-09-01T00:00:00\",\"1958-10-01T00:00:00\",\"1958-11-01T00:00:00\",\"1958-12-01T00:00:00\",\"1959-01-01T00:00:00\",\"1959-02-01T00:00:00\",\"1959-03-01T00:00:00\",\"1959-04-01T00:00:00\",\"1959-05-01T00:00:00\",\"1959-06-01T00:00:00\",\"1959-07-01T00:00:00\",\"1959-08-01T00:00:00\",\"1959-09-01T00:00:00\",\"1959-10-01T00:00:00\",\"1959-11-01T00:00:00\",\"1959-12-01T00:00:00\",\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[112.0,118.0,132.0,129.0,121.0,135.0,148.0,148.0,136.0,119.0,104.0,118.0,115.0,126.0,141.0,135.0,125.0,149.0,170.0,170.0,158.0,133.0,114.0,140.0,145.0,150.0,178.0,163.0,172.0,178.0,199.0,199.0,184.0,162.0,146.0,166.0,171.0,180.0,193.0,181.0,183.0,218.0,230.0,242.0,209.0,191.0,172.0,194.0,196.0,196.0,236.0,235.0,229.0,243.0,264.0,272.0,237.0,211.0,180.0,201.0,204.0,188.0,235.0,227.0,234.0,264.0,302.0,293.0,259.0,229.0,203.0,229.0,242.0,233.0,267.0,269.0,270.0,315.0,364.0,347.0,312.0,274.0,237.0,278.0,284.0,277.0,317.0,313.0,318.0,374.0,413.0,405.0,355.0,306.0,271.0,306.0,315.0,301.0,356.0,348.0,355.0,422.0,465.0,467.0,404.0,347.0,305.0,336.0,340.0,318.0,362.0,348.0,363.0,435.0,491.0,505.0,404.0,359.0,310.0,337.0,360.0,342.0,406.0,396.0,420.0,472.0,548.0,559.0,463.0,407.0,362.0,405.0,417.0,391.0,419.0,461.0,472.0,535.0,622.0,606.0,508.0,461.0,390.0,432.0]}], {\"showlegend\":true,\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"rgb(51,51,51)\"},\"error_y\":{\"color\":\"rgb(51,51,51)\"},\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"baxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"rgb(237,237,237)\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"rgb(217,217,217)\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"colorscale\":{\"sequential\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"sequentialminus\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]]},\"colorway\":[\"#F8766D\",\"#A3A500\",\"#00BF7D\",\"#00B0F6\",\"#E76BF3\"],\"font\":{\"color\":\"rgb(51,51,51)\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"rgb(237,237,237)\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"rgb(237,237,237)\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"fillcolor\":\"black\",\"line\":{\"width\":0},\"opacity\":0.3},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"}}},\"title\":{\"text\":\"Actual vs. Forecast | Number of airline passengers\"},\"xaxis\":{\"title\":{\"text\":\"Time\"}},\"yaxis\":{\"title\":{\"text\":\"Values\"}}}, {\"responsive\": true} ).then(function(){\n",
" \n",
"var gd = document.getElementById('f006682d-03fb-413e-9185-0a275a221548');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; </script> </div>\n",
"</body>\n",
"</html>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "nTBQ3nqO1bQ1",
"outputId": "d4d68139-067c-4996-df69-1865e1c4760c"
},
"source": [
"#### What search space was used? \n",
"fixed_grid = exp.models(internal=True).loc[\"lr_cds_dt\", \"Tune Grid\"]\n",
"fixed_grid"
],
"execution_count": 10,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'degree': [1],\n",
" 'deseasonal_model': ['additive'],\n",
" 'regressor__fit_intercept': [True, False],\n",
" 'regressor__normalize': [True, False],\n",
" 'sp': [12],\n",
" 'window_length': [10]}"
]
},
"metadata": {},
"execution_count": 10
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Ujg8Afhf7XQC"
},
"source": [
"# Part 2: Advanced Tuning & Customization"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "d7N7taoV7GnS"
},
"source": [
"## Looking under the Hood"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206,
"referenced_widgets": [
"eaa6868d64f64b1baf5915bc53a5964b",
"56d3a7026f1a49e290ee2b6968ccc3fa",
"15d588055f634935985bf37ec432f21d"
]
},
"id": "r0KT5iUJ7Ed_",
"outputId": "8e31d40b-d5ae-4196-8bc4-be64cecaa75f"
},
"source": [
"tuned_model_random, random_tuner = exp.tune_model(model, return_tuner=True)"
],
"execution_count": 11,
"outputs": [
{
"output_type": "display_data",
"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>cutoff</th>\n",
" <th>MAE</th>\n",
" <th>RMSE</th>\n",
" <th>MAPE</th>\n",
" <th>SMAPE</th>\n",
" <th>R2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1956-12</td>\n",
" <td>9.2184</td>\n",
" <td>12.1077</td>\n",
" <td>0.0233</td>\n",
" <td>0.0235</td>\n",
" <td>0.9523</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1957-12</td>\n",
" <td>30.6011</td>\n",
" <td>33.3898</td>\n",
" <td>0.0834</td>\n",
" <td>0.0794</td>\n",
" <td>0.7079</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1958-12</td>\n",
" <td>13.6786</td>\n",
" <td>15.8682</td>\n",
" <td>0.0320</td>\n",
" <td>0.0325</td>\n",
" <td>0.9437</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Mean</th>\n",
" <td>NaN</td>\n",
" <td>17.8327</td>\n",
" <td>20.4552</td>\n",
" <td>0.0462</td>\n",
" <td>0.0452</td>\n",
" <td>0.8680</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SD</th>\n",
" <td>NaN</td>\n",
" <td>9.2104</td>\n",
" <td>9.2741</td>\n",
" <td>0.0265</td>\n",
" <td>0.0245</td>\n",
" <td>0.1132</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cutoff MAE RMSE MAPE SMAPE R2\n",
"0 1956-12 9.2184 12.1077 0.0233 0.0235 0.9523\n",
"1 1957-12 30.6011 33.3898 0.0834 0.0794 0.7079\n",
"2 1958-12 13.6786 15.8682 0.0320 0.0325 0.9437\n",
"Mean NaN 17.8327 20.4552 0.0462 0.0452 0.8680\n",
"SD NaN 9.2104 9.2741 0.0265 0.0245 0.1132"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Ssaih1JQ7PYK",
"outputId": "a9edeac8-7c1f-4bff-9fe3-cc816199f7be"
},
"source": [
"tuned_model_random"
],
"execution_count": 12,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"BaseCdsDtForecaster(degree=2, deseasonal_model='multiplicative',\n",
" regressor=LinearRegression(copy_X=True, fit_intercept=False,\n",
" n_jobs=-1, normalize=True,\n",
" positive=False),\n",
" sp=12, window_length=23)"
]
},
"metadata": {},
"execution_count": 12
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 730
},
"id": "0gs8eRgn7LFC",
"outputId": "032c41e9-51ff-4428-b21b-06e0f5aad784"
},
"source": [
"import pandas as pd\n",
"pd.DataFrame(random_tuner.cv_results_).sort_values(\"rank_test_smape\")"
],
"execution_count": 13,
"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>mean_fit_time</th>\n",
" <th>std_fit_time</th>\n",
" <th>mean_score_time</th>\n",
" <th>std_score_time</th>\n",
" <th>param_degree</th>\n",
" <th>param_deseasonal_model</th>\n",
" <th>param_regressor__fit_intercept</th>\n",
" <th>param_regressor__normalize</th>\n",
" <th>param_sp</th>\n",
" <th>param_window_length</th>\n",
" <th>params</th>\n",
" <th>split0_test_smape</th>\n",
" <th>split1_test_smape</th>\n",
" <th>split2_test_smape</th>\n",
" <th>mean_test_smape</th>\n",
" <th>std_test_smape</th>\n",
" <th>rank_test_smape</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>0.018198</td>\n",
" <td>0.000647</td>\n",
" <td>0.000513</td>\n",
" <td>0.000022</td>\n",
" <td>2</td>\n",
" <td>multiplicative</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>12</td>\n",
" <td>23</td>\n",
" <td>{'degree': 2, 'deseasonal_model': 'multiplicat...</td>\n",
" <td>0.023537</td>\n",
" <td>0.079412</td>\n",
" <td>0.032535</td>\n",
" <td>0.045161</td>\n",
" <td>0.024496</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>0.022529</td>\n",
" <td>0.005692</td>\n",
" <td>0.000531</td>\n",
" <td>0.000016</td>\n",
" <td>3</td>\n",
" <td>multiplicative</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>24</td>\n",
" <td>20</td>\n",
" <td>{'degree': 3, 'deseasonal_model': 'multiplicat...</td>\n",
" <td>0.013970</td>\n",
" <td>0.088033</td>\n",
" <td>0.058526</td>\n",
" <td>0.053510</td>\n",
" <td>0.030443</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>0.018850</td>\n",
" <td>0.001927</td>\n",
" <td>0.000535</td>\n",
" <td>0.000034</td>\n",
" <td>3</td>\n",
" <td>additive</td>\n",
" <td>True</td>\n",
" <td>True</td>\n",
" <td>12</td>\n",
" <td>20</td>\n",
" <td>{'degree': 3, 'deseasonal_model': 'additive', ...</td>\n",
" <td>0.025654</td>\n",
" <td>0.094477</td>\n",
" <td>0.056408</td>\n",
" <td>0.058846</td>\n",
" <td>0.028150</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.020537</td>\n",
" <td>0.003949</td>\n",
" <td>0.000508</td>\n",
" <td>0.000020</td>\n",
" <td>5</td>\n",
" <td>additive</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>12</td>\n",
" <td>22</td>\n",
" <td>{'degree': 5, 'deseasonal_model': 'additive', ...</td>\n",
" <td>0.128711</td>\n",
" <td>0.090898</td>\n",
" <td>0.276334</td>\n",
" <td>0.165315</td>\n",
" <td>0.080006</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.026006</td>\n",
" <td>0.011879</td>\n",
" <td>0.000526</td>\n",
" <td>0.000019</td>\n",
" <td>7</td>\n",
" <td>multiplicative</td>\n",
" <td>True</td>\n",
" <td>True</td>\n",
" <td>12</td>\n",
" <td>19</td>\n",
" <td>{'degree': 7, 'deseasonal_model': 'multiplicat...</td>\n",
" <td>0.346732</td>\n",
" <td>0.136618</td>\n",
" <td>0.058932</td>\n",
" <td>0.180761</td>\n",
" <td>0.121569</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>0.019979</td>\n",
" <td>0.001680</td>\n",
" <td>0.001169</td>\n",
" <td>0.000908</td>\n",
" <td>6</td>\n",
" <td>additive</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>12</td>\n",
" <td>22</td>\n",
" <td>{'degree': 6, 'deseasonal_model': 'additive', ...</td>\n",
" <td>0.465248</td>\n",
" <td>0.122866</td>\n",
" <td>0.169175</td>\n",
" <td>0.252430</td>\n",
" <td>0.151668</td>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>0.014420</td>\n",
" <td>0.002230</td>\n",
" <td>0.000435</td>\n",
" <td>0.000092</td>\n",
" <td>9</td>\n",
" <td>multiplicative</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>24</td>\n",
" <td>23</td>\n",
" <td>{'degree': 9, 'deseasonal_model': 'multiplicat...</td>\n",
" <td>0.486684</td>\n",
" <td>0.356662</td>\n",
" <td>0.286260</td>\n",
" <td>0.376535</td>\n",
" <td>0.083021</td>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.017079</td>\n",
" <td>0.002430</td>\n",
" <td>0.000514</td>\n",
" <td>0.000012</td>\n",
" <td>6</td>\n",
" <td>additive</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>24</td>\n",
" <td>17</td>\n",
" <td>{'degree': 6, 'deseasonal_model': 'additive', ...</td>\n",
" <td>0.878960</td>\n",
" <td>0.395391</td>\n",
" <td>0.332351</td>\n",
" <td>0.535568</td>\n",
" <td>0.244175</td>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>0.023635</td>\n",
" <td>0.008199</td>\n",
" <td>0.000577</td>\n",
" <td>0.000073</td>\n",
" <td>8</td>\n",
" <td>additive</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>24</td>\n",
" <td>14</td>\n",
" <td>{'degree': 8, 'deseasonal_model': 'additive', ...</td>\n",
" <td>1.570728</td>\n",
" <td>0.285090</td>\n",
" <td>0.212746</td>\n",
" <td>0.689521</td>\n",
" <td>0.623807</td>\n",
" <td>9</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>0.018477</td>\n",
" <td>0.001986</td>\n",
" <td>0.000664</td>\n",
" <td>0.000168</td>\n",
" <td>7</td>\n",
" <td>multiplicative</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>24</td>\n",
" <td>13</td>\n",
" <td>{'degree': 7, 'deseasonal_model': 'multiplicat...</td>\n",
" <td>1.186817</td>\n",
" <td>0.547635</td>\n",
" <td>0.345657</td>\n",
" <td>0.693370</td>\n",
" <td>0.358531</td>\n",
" <td>10</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mean_fit_time std_fit_time ... std_test_smape rank_test_smape\n",
"4 0.018198 0.000647 ... 0.024496 1\n",
"6 0.022529 0.005692 ... 0.030443 2\n",
"7 0.018850 0.001927 ... 0.028150 3\n",
"1 0.020537 0.003949 ... 0.080006 4\n",
"0 0.026006 0.011879 ... 0.121569 5\n",
"5 0.019979 0.001680 ... 0.151668 6\n",
"9 0.014420 0.002230 ... 0.083021 7\n",
"3 0.017079 0.002430 ... 0.244175 8\n",
"2 0.023635 0.008199 ... 0.623807 9\n",
"8 0.018477 0.001986 ... 0.358531 10\n",
"\n",
"[10 rows x 17 columns]"
]
},
"metadata": {},
"execution_count": 13
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dKWCVFBdRnwU"
},
"source": [
"Observations\n",
"\n",
"1. Seasonal period of harmonics of 12 (e.g. 24) can be helpful\n",
"2. Lower detrending degree gives better results\n",
"\n",
"Why not limit the search space using these observations to see if we can improve the performance more.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8as2oksS1fnh"
},
"source": [
"## Tuning Customization"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "nwZp8OtCeFu0",
"outputId": "98cf736e-b73b-4e95-cccc-5ba96eb69fe4"
},
"source": [
"random_grid['sp'] = [12, 24, 36]\n",
"random_grid['degree'] = [1, 2, 3]\n",
"random_grid"
],
"execution_count": 14,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'degree': [1, 2, 3],\n",
" 'deseasonal_model': CategoricalDistribution(values=['additive', 'multiplicative']),\n",
" 'regressor__fit_intercept': CategoricalDistribution(values=[True, False]),\n",
" 'regressor__normalize': CategoricalDistribution(values=[True, False]),\n",
" 'sp': [12, 24, 36],\n",
" 'window_length': IntUniformDistribution(lower=12, upper=24, log=False)}"
]
},
"metadata": {},
"execution_count": 14
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 731,
"referenced_widgets": [
"2270d7c69841478cb8a605207bd22c61",
"9f1ce398a2244e11b655f1010f43faee",
"7c53fde06be74021935a10e5df8cd1bd"
]
},
"id": "XcQt4eB3eSPG",
"outputId": "75cee6db-99fc-410f-bc15-0abe9e874aea"
},
"source": [
"better_tuned_random = exp.tune_model(model, custom_grid=random_grid, n_iter=20)\n",
"exp.plot_model(better_tuned_random)"
],
"execution_count": 15,
"outputs": [
{
"output_type": "display_data",
"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>cutoff</th>\n",
" <th>MAE</th>\n",
" <th>RMSE</th>\n",
" <th>MAPE</th>\n",
" <th>SMAPE</th>\n",
" <th>R2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1956-12</td>\n",
" <td>10.1316</td>\n",
" <td>13.9316</td>\n",
" <td>0.0251</td>\n",
" <td>0.0255</td>\n",
" <td>0.9368</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1957-12</td>\n",
" <td>28.7971</td>\n",
" <td>32.4905</td>\n",
" <td>0.0803</td>\n",
" <td>0.0763</td>\n",
" <td>0.7235</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1958-12</td>\n",
" <td>6.8656</td>\n",
" <td>8.9367</td>\n",
" <td>0.0153</td>\n",
" <td>0.0155</td>\n",
" <td>0.9821</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Mean</th>\n",
" <td>NaN</td>\n",
" <td>15.2648</td>\n",
" <td>18.4530</td>\n",
" <td>0.0402</td>\n",
" <td>0.0391</td>\n",
" <td>0.8808</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SD</th>\n",
" <td>NaN</td>\n",
" <td>9.6613</td>\n",
" <td>10.1334</td>\n",
" <td>0.0286</td>\n",
" <td>0.0266</td>\n",
" <td>0.1128</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cutoff MAE RMSE MAPE SMAPE R2\n",
"0 1956-12 10.1316 13.9316 0.0251 0.0255 0.9368\n",
"1 1957-12 28.7971 32.4905 0.0803 0.0763 0.7235\n",
"2 1958-12 6.8656 8.9367 0.0153 0.0155 0.9821\n",
"Mean NaN 15.2648 18.4530 0.0402 0.0391 0.8808\n",
"SD NaN 9.6613 10.1334 0.0286 0.0266 0.1128"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": [
"<html>\n",
"<head><meta charset=\"utf-8\" /></head>\n",
"<body>\n",
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
" <script src=\"https://cdn.plot.ly/plotly-2.4.2.min.js\"></script> <div id=\"df04252d-76a0-43bb-8b71-6788b517738f\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"df04252d-76a0-43bb-8b71-6788b517738f\")) { Plotly.newPlot( \"df04252d-76a0-43bb-8b71-6788b517738f\", [{\"line\":{\"color\":\"#1f77b4\"},\"marker\":{\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Forecast | LinearRegression\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[421.1928,410.5165,468.7937,454.1795,467.746,525.0217,591.5151,591.3682,505.9683,447.3416,390.5644,439.3004]},{\"marker\":{\"color\":\"#3f3f3f\",\"size\":5},\"mode\":\"lines+markers\",\"name\":\"Original\",\"showlegend\":true,\"type\":\"scatter\",\"x\":[\"1949-01-01T00:00:00\",\"1949-02-01T00:00:00\",\"1949-03-01T00:00:00\",\"1949-04-01T00:00:00\",\"1949-05-01T00:00:00\",\"1949-06-01T00:00:00\",\"1949-07-01T00:00:00\",\"1949-08-01T00:00:00\",\"1949-09-01T00:00:00\",\"1949-10-01T00:00:00\",\"1949-11-01T00:00:00\",\"1949-12-01T00:00:00\",\"1950-01-01T00:00:00\",\"1950-02-01T00:00:00\",\"1950-03-01T00:00:00\",\"1950-04-01T00:00:00\",\"1950-05-01T00:00:00\",\"1950-06-01T00:00:00\",\"1950-07-01T00:00:00\",\"1950-08-01T00:00:00\",\"1950-09-01T00:00:00\",\"1950-10-01T00:00:00\",\"1950-11-01T00:00:00\",\"1950-12-01T00:00:00\",\"1951-01-01T00:00:00\",\"1951-02-01T00:00:00\",\"1951-03-01T00:00:00\",\"1951-04-01T00:00:00\",\"1951-05-01T00:00:00\",\"1951-06-01T00:00:00\",\"1951-07-01T00:00:00\",\"1951-08-01T00:00:00\",\"1951-09-01T00:00:00\",\"1951-10-01T00:00:00\",\"1951-11-01T00:00:00\",\"1951-12-01T00:00:00\",\"1952-01-01T00:00:00\",\"1952-02-01T00:00:00\",\"1952-03-01T00:00:00\",\"1952-04-01T00:00:00\",\"1952-05-01T00:00:00\",\"1952-06-01T00:00:00\",\"1952-07-01T00:00:00\",\"1952-08-01T00:00:00\",\"1952-09-01T00:00:00\",\"1952-10-01T00:00:00\",\"1952-11-01T00:00:00\",\"1952-12-01T00:00:00\",\"1953-01-01T00:00:00\",\"1953-02-01T00:00:00\",\"1953-03-01T00:00:00\",\"1953-04-01T00:00:00\",\"1953-05-01T00:00:00\",\"1953-06-01T00:00:00\",\"1953-07-01T00:00:00\",\"1953-08-01T00:00:00\",\"1953-09-01T00:00:00\",\"1953-10-01T00:00:00\",\"1953-11-01T00:00:00\",\"1953-12-01T00:00:00\",\"1954-01-01T00:00:00\",\"1954-02-01T00:00:00\",\"1954-03-01T00:00:00\",\"1954-04-01T00:00:00\",\"1954-05-01T00:00:00\",\"1954-06-01T00:00:00\",\"1954-07-01T00:00:00\",\"1954-08-01T00:00:00\",\"1954-09-01T00:00:00\",\"1954-10-01T00:00:00\",\"1954-11-01T00:00:00\",\"1954-12-01T00:00:00\",\"1955-01-01T00:00:00\",\"1955-02-01T00:00:00\",\"1955-03-01T00:00:00\",\"1955-04-01T00:00:00\",\"1955-05-01T00:00:00\",\"1955-06-01T00:00:00\",\"1955-07-01T00:00:00\",\"1955-08-01T00:00:00\",\"1955-09-01T00:00:00\",\"1955-10-01T00:00:00\",\"1955-11-01T00:00:00\",\"1955-12-01T00:00:00\",\"1956-01-01T00:00:00\",\"1956-02-01T00:00:00\",\"1956-03-01T00:00:00\",\"1956-04-01T00:00:00\",\"1956-05-01T00:00:00\",\"1956-06-01T00:00:00\",\"1956-07-01T00:00:00\",\"1956-08-01T00:00:00\",\"1956-09-01T00:00:00\",\"1956-10-01T00:00:00\",\"1956-11-01T00:00:00\",\"1956-12-01T00:00:00\",\"1957-01-01T00:00:00\",\"1957-02-01T00:00:00\",\"1957-03-01T00:00:00\",\"1957-04-01T00:00:00\",\"1957-05-01T00:00:00\",\"1957-06-01T00:00:00\",\"1957-07-01T00:00:00\",\"1957-08-01T00:00:00\",\"1957-09-01T00:00:00\",\"1957-10-01T00:00:00\",\"1957-11-01T00:00:00\",\"1957-12-01T00:00:00\",\"1958-01-01T00:00:00\",\"1958-02-01T00:00:00\",\"1958-03-01T00:00:00\",\"1958-04-01T00:00:00\",\"1958-05-01T00:00:00\",\"1958-06-01T00:00:00\",\"1958-07-01T00:00:00\",\"1958-08-01T00:00:00\",\"1958-09-01T00:00:00\",\"1958-10-01T00:00:00\",\"1958-11-01T00:00:00\",\"1958-12-01T00:00:00\",\"1959-01-01T00:00:00\",\"1959-02-01T00:00:00\",\"1959-03-01T00:00:00\",\"1959-04-01T00:00:00\",\"1959-05-01T00:00:00\",\"1959-06-01T00:00:00\",\"1959-07-01T00:00:00\",\"1959-08-01T00:00:00\",\"1959-09-01T00:00:00\",\"1959-10-01T00:00:00\",\"1959-11-01T00:00:00\",\"1959-12-01T00:00:00\",\"1960-01-01T00:00:00\",\"1960-02-01T00:00:00\",\"1960-03-01T00:00:00\",\"1960-04-01T00:00:00\",\"1960-05-01T00:00:00\",\"1960-06-01T00:00:00\",\"1960-07-01T00:00:00\",\"1960-08-01T00:00:00\",\"1960-09-01T00:00:00\",\"1960-10-01T00:00:00\",\"1960-11-01T00:00:00\",\"1960-12-01T00:00:00\"],\"y\":[112.0,118.0,132.0,129.0,121.0,135.0,148.0,148.0,136.0,119.0,104.0,118.0,115.0,126.0,141.0,135.0,125.0,149.0,170.0,170.0,158.0,133.0,114.0,140.0,145.0,150.0,178.0,163.0,172.0,178.0,199.0,199.0,184.0,162.0,146.0,166.0,171.0,180.0,193.0,181.0,183.0,218.0,230.0,242.0,209.0,191.0,172.0,194.0,196.0,196.0,236.0,235.0,229.0,243.0,264.0,272.0,237.0,211.0,180.0,201.0,204.0,188.0,235.0,227.0,234.0,264.0,302.0,293.0,259.0,229.0,203.0,229.0,242.0,233.0,267.0,269.0,270.0,315.0,364.0,347.0,312.0,274.0,237.0,278.0,284.0,277.0,317.0,313.0,318.0,374.0,413.0,405.0,355.0,306.0,271.0,306.0,315.0,301.0,356.0,348.0,355.0,422.0,465.0,467.0,404.0,347.0,305.0,336.0,340.0,318.0,362.0,348.0,363.0,435.0,491.0,505.0,404.0,359.0,310.0,337.0,360.0,342.0,406.0,396.0,420.0,472.0,548.0,559.0,463.0,407.0,362.0,405.0,417.0,391.0,419.0,461.0,472.0,535.0,622.0,606.0,508.0,461.0,390.0,432.0]}], {\"showlegend\":true,\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"rgb(51,51,51)\"},\"error_y\":{\"color\":\"rgb(51,51,51)\"},\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgb(237,237,237)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"baxis\":{\"endlinecolor\":\"rgb(51,51,51)\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"rgb(51,51,51)\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"},\"colorscale\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"rgb(237,237,237)\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"rgb(217,217,217)\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"tickcolor\":\"rgb(237,237,237)\",\"ticklen\":6,\"ticks\":\"inside\"}},\"colorscale\":{\"sequential\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]],\"sequentialminus\":[[0,\"rgb(20,44,66)\"],[1,\"rgb(90,179,244)\"]]},\"colorway\":[\"#F8766D\",\"#A3A500\",\"#00BF7D\",\"#00B0F6\",\"#E76BF3\"],\"font\":{\"color\":\"rgb(51,51,51)\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"rgb(237,237,237)\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"rgb(237,237,237)\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"rgb(237,237,237)\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"fillcolor\":\"black\",\"line\":{\"width\":0},\"opacity\":0.3},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"},\"bgcolor\":\"rgb(237,237,237)\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\"}},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showgrid\":true,\"tickcolor\":\"rgb(51,51,51)\",\"ticks\":\"outside\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\"}}},\"title\":{\"text\":\"Actual vs. Forecast | Number of airline passengers\"},\"xaxis\":{\"title\":{\"text\":\"Time\"}},\"yaxis\":{\"title\":{\"text\":\"Values\"}}}, {\"responsive\": true} ).then(function(){\n",
" \n",
"var gd = document.getElementById('df04252d-76a0-43bb-8b71-6788b517738f');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; </script> </div>\n",
"</body>\n",
"</html>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "aHNw-PhZ20rC",
"outputId": "16fb4dba-f7f8-4d1a-f424-072dfca1bab4"
},
"source": [
"better_tuned_random"
],
"execution_count": 16,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"BaseCdsDtForecaster(degree=2, deseasonal_model='multiplicative',\n",
" regressor=LinearRegression(copy_X=True, fit_intercept=False,\n",
" n_jobs=-1, normalize=False,\n",
" positive=False),\n",
" sp=12, window_length=13)"
]
},
"metadata": {},
"execution_count": 16
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "pouP2picSYuY"
},
"source": [
"**Observations**\n",
"\n",
"1. Model performance during cross-validation has been improved. For example\n",
" - MAE reduced from 17.8 in the random grid search case to 15.2 using the custom grid).\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "kUlCB5YM7sHu"
},
"source": [
"Happy forecasting!"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment