{ "info": { "author": "Jinyu Xie", "author_email": "xjygr08@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# fireTS #\n[![Documentation Status](https://readthedocs.org/projects/firets/badge/?version=latest)](https://firets.readthedocs.io/en/latest/?badge=latest)\n\n`fireTS` is a sklean style package for multi-variate time-series prediction. Here is a simple code snippet to showcase the awesome features provided by `fireTS` package.\n```python\nfrom fireTS.models import NARX, DirectAutoRegressor\nfrom sklearn.ensemble import RandomForestRegressor\nfrom xgboost import XGBRegressor\nimport numpy as np\n\n# Random training data\nx = np.random.randn(100, 2)\ny = np.random.randn(100)\n\n# Build a non-linear autoregression model with exogenous inputs\n# using Random Forest regression as the base model\nmdl1 = NARX(\n RandomForestRegressor(n_estimators=10),\n auto_order=2,\n exog_order=[2, 2],\n exog_delay=[1, 1])\nmdl1.fit(x, y)\nypred1 = mdl1.predict(x, y, step=3)\n\n# Build a general autoregression model and make multi-step prediction directly\n# using XGBRegressor as the base model\nmdl2 = DirectAutoRegressor(\n XGBRegressor(n_estimators=10),\n auto_order=2,\n exog_order=[2, 2],\n exog_delay=[1, 1],\n pred_step=3)\nmdl2.fit(x, y)\nypred2 = mdl2.predict(x, y)\n```\n- `sklearn` style API. The package provides `fit` and `predict` methods, which is very similar to `sklearn` package. \n- Plug-and-go. You are able to plug in any machine learning regression algorithms provided in `sklearn` package and build a time-series forecasting model.\n- Create the lag features for you by specifying the autoregression order `auto_order`, the exogenous input order `exog_order`, and the exogenous input delay `exog_delay`.\n- Support multi-step prediction. The package can make multi-step prediction in two different ways: recursive way and direct way. `NARX` model is to build a one-step-ahead-predictive model, and the model will be used recursively to make multi-step prediction (future exogenous input information is needed). `DirectAutoRegressor` makes multi-step prediction directly (no future exogenous input information is needed) by specifying the prediction step in the constructor.\n- Support grid search to tune the hyper-parameters of the base model (cannot do grid search on the orders and delays of the time series model for now). \n\nI developed this package when writing [this paper](http://ceur-ws.org/Vol-2148/paper16.pdf). It is really handy to generate lag features and leverage various regression algorithms provided by sklearn to build non-linear multi-variate time series models. The API can also be used to build deep neural network models to make time-series prediction. [The paper](http://ceur-ws.org/Vol-2148/paper16.pdf) used this package to build LSTM models and make multi-step predictions.\n\nThe documentation can be found [here](https://firets.readthedocs.io/en/latest/). The documentation provides the mathematical equations of each model. It is highly recommended to read the documentation before using the model.\n\n### Nonlinear AutoRegression with eXogenous (NARX) model\n`fireTS.models.NARX` model is trying to train a one-step-ahead-prediction model\nand make multi-step prediction recursively given the future exogenous inputs.\n\nGiven the output time series to predict `y(t)` and exogenous inputs `X(t)` The model will generate target and features as follows:\n\n| Target | Features |\n| ------------- |:-------------:|\n| y(t + 1) | y(t), y(t - 1), ..., y(t - p + 1), X(t - d), X(t - d - 1), ..., X(t - d - q + 1) |\n\nwhere p is the autogression order `auto_order`, q is the exogenous input order `exog_order`, d is the exogenous delay `exog_delay`.\n\nNARX model can make any step ahead prediction given the future exogenous inputs. To make multi-step prediction, set the `step` in the `predict` method.\n\n### Direct Autoregressor\n`fireTS.models.DirectAutoRegressor` model is trying to train a \nmulti-step-head-prediction model directly. No future exogenous inputs are\nrequired to make the multi-step prediction.\n\nGiven the output time series to predict `y(t)` and exogenous inputs `X(t)` The model will generate target and features as follows:\n\n| Target | Features |\n| ------------- |:-------------:|\n| y(t + k) | y(t), y(t - 1), ..., y(t - p + 1), X(t - d), X(t - d - 1), ..., X(t - d - q + 1) |\n\nwhere p is the autogression order `auto_order`, q is the exogenous input order `exog_order`, d is the exogenous delay `exog_delay`, k is the prediction step `pred_step`.\n\nDirect autoregressor does not require future exogenous input information to make multi-step prediction. Its `predict` method cannot specify prediction step.\n\n## Installation ##\n**NOTE**: Only python3 is supported.\n\nIt is highly recommended to use `pip` to install `fireTS`, follow this\n [link](https://pip.pypa.io/en/stable/installing/) to install pip.\n\nAfter pip is installed, \n```\npip install fireTS\n```\n\nTo get the latest development version, \n```\ngit clone https://github.com/jxx123/fireTS.git\ncd fireTS\npip install -e .\n```\n\n## Quick Start ##\n- Use `RandomForestRegressor` as base model to build a `NARX` model\n```python\nfrom fireTS.models import NARX\nfrom sklearn.ensemble import RandomForestRegressor\nimport numpy as np\n\nx = np.random.randn(100, 1)\ny = np.random.randn(100)\nmdl = NARX(RandomForestRegressor(), auto_order=2, exog_order=[2], exog_delay=[1])\nmdl.fit(x, y)\nypred = mdl.predict(x, y, step=3)\n```\n- Use `RandomForestRegressor` as base model to build a `DirectAutoRegressor` model\n```python\nfrom fireTS.models import DirectAutoRegressor\nfrom sklearn.ensemble import RandomForestRegressor\nimport numpy as np\n\nx = np.random.randn(100, 1)\ny = np.random.randn(100)\nmdl = DirectAutoRegressor(RandomForestRegressor(), \n auto_order=2, \n exog_order=[2], \n exog_delay=[1], \n pred_step=3)\nmdl.fit(x, y)\nypred = mdl.predict(x, y)\n```\n- Usage of grid search\n```python\nfrom fireTS.models import NARX\nfrom sklearn.ensemble import RandomForestRegressor\nimport numpy as np\n\nx = np.random.randn(100, 1)\ny = np.random.randn(100)\n\n# DirectAutoRegressor can do grid search as well\nmdl = NARX(RandomForestRegressor(), auto_order=2, exog_order=[2], exog_delay=[1])\n\n# Grid search\npara_grid = {'n_estimators': [10, 30, 100]}\nmdl.grid_search(x, y, para_grid, verbose=2)\n\n# Best hyper-parameters are set after grid search, print the model to see the difference\nprint(mdl)\n\n# Fit the model and make the prediction\nmdl.fit(x, y)\nypred = mdl.predict(x, y, step=3)\n```\nThe examples folder provides more realistic examples. The [example1](https://github.com/jxx123/fireTS/blob/master/examples/Basic%20usage%20of%20NARX%20and%20DirectAutoregressor.ipynb) and [example2](https://github.com/jxx123/fireTS/blob/master/examples/Use%20Grid%20Search%20to%20tune%20the%20hyper-parameter%20of%20base%20model.ipynb) use the data simulated by [simglucose pakage](https://github.com/jxx123/simglucose) to fit time series model and make multi-step prediction.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jxx123/fireTS.git", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "fireTS", "package_url": "https://pypi.org/project/fireTS/", "platform": "", "project_url": "https://pypi.org/project/fireTS/", "project_urls": { "Homepage": "https://github.com/jxx123/fireTS.git" }, "release_url": "https://pypi.org/project/fireTS/0.0.7/", "requires_dist": [ "numpy", "scipy", "scikit-learn" ], "requires_python": "", "summary": "A python package for multi-variate time series prediction", "version": "0.0.7" }, "last_serial": 4323312, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6877f26f43ef6f91c9df485d27f4683a", "sha256": "2b0d3e5d5425326870cc573e1e41abc198132b82c94795017e11481c265bf23e" }, "downloads": -1, "filename": "fireTS-0.0.1.tar.gz", "has_sig": false, "md5_digest": "6877f26f43ef6f91c9df485d27f4683a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5571838, "upload_time": "2018-08-09T03:50:00", "url": "https://files.pythonhosted.org/packages/48/1f/3143571a10af4ddffa524cbb64432660537f00fb5a1ce6e9ba5eab3c1694/fireTS-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f757a964b14143a4c34ffdd006fcf41a", "sha256": "2a83c08ff2458d5ece82c64e87484ad453bba10a40e8c48f360cfa2f820a2f1f" }, "downloads": -1, "filename": "fireTS-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f757a964b14143a4c34ffdd006fcf41a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6118, "upload_time": "2018-08-09T03:57:48", "url": "https://files.pythonhosted.org/packages/00/54/d0ba4abe5320b882aa2c658511cf61c6a98963d8851918b025d35e063470/fireTS-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "83333730e54e10d3c18e68d49e4b6491", "sha256": "1638053f90371196a161e27fca02cb63653879ff82b1b7cbd596896fe61962a7" }, "downloads": -1, "filename": "fireTS-0.0.2.tar.gz", "has_sig": false, "md5_digest": "83333730e54e10d3c18e68d49e4b6491", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5571898, "upload_time": "2018-08-09T03:52:18", "url": "https://files.pythonhosted.org/packages/3e/14/9f3052fe29b2aeaaf2bea6d00800ec8d23fcc979b39d85dbf482df0704db/fireTS-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "3d40257edd3c9c4e2376a5a756bcf4bd", "sha256": "fa03cc9f700abeee1406e80602ade381ccf97c8dd8e3f489ee5e1a4ca88ae27f" }, "downloads": -1, "filename": "fireTS-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3d40257edd3c9c4e2376a5a756bcf4bd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6120, "upload_time": "2018-08-09T03:59:34", "url": "https://files.pythonhosted.org/packages/62/62/89b4188f87dc6ad434ffcae529ef45750594f680f8ef7b926d42b6e0ac8c/fireTS-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "897f55998b0d3a15f953ea7a797f4c67", "sha256": "c36f86e49c442ee8e2ade1d12b3139770b7308c59504368ee38a53122856a887" }, "downloads": -1, "filename": "fireTS-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "897f55998b0d3a15f953ea7a797f4c67", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6145, "upload_time": "2018-08-11T02:39:24", "url": "https://files.pythonhosted.org/packages/ad/5a/30f543ba13f8c69160a92ea43aecd634dd9838580d203d31abf898229bcc/fireTS-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "b8dc0e607a4f2f13fbb4222f7d4a5ba1", "sha256": "0144ef3c3702c3c3f8bbbc630b3aa4f2d536d89d735517cbd258a2543a9be774" }, "downloads": -1, "filename": "fireTS-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "b8dc0e607a4f2f13fbb4222f7d4a5ba1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7737, "upload_time": "2018-08-30T22:21:35", "url": "https://files.pythonhosted.org/packages/8f/c2/3ef1ce2c3a2023c12ff7e34caf4105f3d87e9155329f434779f00cc438e0/fireTS-0.0.5-py3-none-any.whl" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "4559701da164e2c82667847ef6c902d6", "sha256": "d93d4c7b9f42ae7a22dffb46165f8bb7d12036df6370d5cdc5888ae068f711d4" }, "downloads": -1, "filename": "fireTS-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "4559701da164e2c82667847ef6c902d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7917, "upload_time": "2018-09-06T03:51:26", "url": "https://files.pythonhosted.org/packages/d9/20/7db782c5f581c5867db70abffcbd16b72edc45c65b605b6e96be09480980/fireTS-0.0.6-py3-none-any.whl" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "7e73443fec8e706bdcc247ead04e6239", "sha256": "7675f62816783d83c0caf3ef0c8b44899b16d804dc1e6bdc92b42315cc5286ea" }, "downloads": -1, "filename": "fireTS-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "7e73443fec8e706bdcc247ead04e6239", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8003, "upload_time": "2018-09-29T18:40:13", "url": "https://files.pythonhosted.org/packages/a9/73/39d9e816ce156986afc4ce23376a77eb13d6bd36249004cda6c7cb9c26e8/fireTS-0.0.7-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7e73443fec8e706bdcc247ead04e6239", "sha256": "7675f62816783d83c0caf3ef0c8b44899b16d804dc1e6bdc92b42315cc5286ea" }, "downloads": -1, "filename": "fireTS-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "7e73443fec8e706bdcc247ead04e6239", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8003, "upload_time": "2018-09-29T18:40:13", "url": "https://files.pythonhosted.org/packages/a9/73/39d9e816ce156986afc4ce23376a77eb13d6bd36249004cda6c7cb9c26e8/fireTS-0.0.7-py3-none-any.whl" } ] }