[![PyPI - Downloads](https://img.shields.io/pypi/dm/knn-tspi)](https://pypistats.org/packages/knn-tspi)
![PyPI - Format](https://img.shields.io/pypi/format/knn-tspi)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/knn-tspi)
[![PyPI - License](https://img.shields.io/pypi/l/knn-tspi)](https://github.com/GDalforno/KNN-TSPI/blob/main/LICENSE.txt)
![PyPI - Status](https://img.shields.io/pypi/status/knn-tspi)
[![PyPI - Version](https://img.shields.io/pypi/v/knn-tspi)](https://pypi.org/project/knn-tspi/)
[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)
[![Workflow](https://img.shields.io/github/actions/workflow/status/GDalforno/KNN-TSPI/publish.yaml)](https://github.com/GDalforno/KNN-TSPI/actions)
[![codecov](https://codecov.io/gh/GDalforno/KNN-TSPI/graph/badge.svg?token=JU4LNQ08D3)](https://codecov.io/gh/GDalforno/KNN-TSPI)
[![Release](https://img.shields.io/github/v/release/GDalforno/KNN-TSPI)](https://github.com/GDalforno/KNN-TSPI/releases)
![Last Commit](https://img.shields.io/github/last-commit/GDalforno/KNN-TSPI)
![Forks](https://img.shields.io/github/forks/GDalforno/KNN-TSPI)
![Repo Stars](https://img.shields.io/github/stars/GDalforno/KNN-TSPI)
<image alt="logo.png" src="https://raw.githubusercontent.com/GDalforno/KNN-TSPI/main/docs/images/logo.png" width="150rem"/>
K-Nearest Neighbors Time Series Prediction with Invariances (KNN-TSPI) algorithm implementation in python. For details about the model access the [paper](https://www.researchgate.net/publication/300414605_A_Study_of_the_Use_of_Complexity_Measures_in_the_Similarity_Search_Process_Adopted_by_kNN_Algorithm_for_Time_Series_Prediction).
## Installation
### Dependencies
The package depends on the following third party libraries:
- `numpy`
### User Installation
Make sure you have `pip` package manager installed in your environment, then run:
```sh
pip install knn-tspi
```
## Getting Started
Once the package is installed successfully, you can import the `KNeighborsTSPI` class and start forecasting univariate time series in a scikit-learn like manner.
```python
import numpy as np
from knn_tspi import KNeighborsTSPI
data = 0.5 * np.arange(60) + np.random.randn(60)
model = KNeighborsTSPI()
model.fit(data)
y = model.predict(h=5)
```
For more detailed examples on how to use the package access [examples](https://github.com/GDalforno/KNN-TSPI/tree/main/examples).
## Development
### Source Code
Clone the repo with the command:
```
git clone https://github.com/GDalforno/KNN-TSPI.git
```
### Setup
Create a python virtual environment and activate it with the command:
```sh
python3.11 -m venv .venv
source .venv/bin/activate
```
Then, set the enviroment up with the command:
```sh
make setup-dev
```
### Testing
Once the setup is completed, launch the test suite for sanity check with:
```sh
make test-dev
```
### Contributing
You can contributing to the project by opening issues, pull requests and reviewing the code. It will help us a lot if you reference the package on blog posts, articlesm social media, etc.
## License
This project is licensed under the MIT License - see the [License](https://github.com/GDalforno/KNN-TSPI/blob/main/LICENSE.txt) file for details.
## Changelog
See the [changelog](https://github.com/GDalforno/KNN-TSPI/blob/main/CHANGES.txt) for a history of notable changes to knn-tspi.
## Project History
During my research in the field of application of machine learning to forecast time series in 2020, I stumbled with a lack of algorithms and frameworks specialized in this task.
One of my colleagues, [Moisés Rocha](https://github.com/moisesrsantos), send me the paper of a modified KNN for time series prediction along with the experiment code written in MATLAB to help me out with my work. A coupled of days after it, I managed to port the code to both python and R and created this repo to store the resulted files.
Throughtout the years that followed, I have seen a growing interest in this repo, and now, I decided to publish it on pip to make it easier for people to include the model in their time series forecasting toolbox as I did a couple of years ago. As far as I know, there is no other implementation of the KNN-TSPI out there.
I am not planning on creating a CRAN package to distribute the model for the R community anytime soon. With that being said, feel free to implement it yourself if you wish. The core R code can be found [here](https://github.com/GDalforno/KNN-TSPI/tree/main/legacy).
## Communication
- Linkedin: https://www.linkedin.com/in/gabriel-dalforno-7b47ba227/
## References
1. Parmezan, Antonio & Batista, Gustavo. (2015). A Study of the Use of Complexity Measures in the Similarity Search Process Adopted by kNN Algorithm for Time Series Prediction. 45-51. 10.1109/ICMLA.2015.217.
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/knn-tspi/",
"name": "knn-tspi",
"maintainer": "GDalforno",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": "gdalforno7@gmail.com",
"keywords": "time series, forecasting, machine learning",
"author": "GDalforno",
"author_email": "gdalforno7@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bb/ab/db9a16d03789a4758a525e9d15f9a20c12ca2968fe636192e82fc5ae82cf/knn_tspi-1.0.1.tar.gz",
"platform": null,
"description": "[![PyPI - Downloads](https://img.shields.io/pypi/dm/knn-tspi)](https://pypistats.org/packages/knn-tspi)\n![PyPI - Format](https://img.shields.io/pypi/format/knn-tspi)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/knn-tspi)\n[![PyPI - License](https://img.shields.io/pypi/l/knn-tspi)](https://github.com/GDalforno/KNN-TSPI/blob/main/LICENSE.txt)\n![PyPI - Status](https://img.shields.io/pypi/status/knn-tspi)\n[![PyPI - Version](https://img.shields.io/pypi/v/knn-tspi)](https://pypi.org/project/knn-tspi/)\n[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)\n[![Workflow](https://img.shields.io/github/actions/workflow/status/GDalforno/KNN-TSPI/publish.yaml)](https://github.com/GDalforno/KNN-TSPI/actions)\n[![codecov](https://codecov.io/gh/GDalforno/KNN-TSPI/graph/badge.svg?token=JU4LNQ08D3)](https://codecov.io/gh/GDalforno/KNN-TSPI)\n[![Release](https://img.shields.io/github/v/release/GDalforno/KNN-TSPI)](https://github.com/GDalforno/KNN-TSPI/releases)\n![Last Commit](https://img.shields.io/github/last-commit/GDalforno/KNN-TSPI)\n![Forks](https://img.shields.io/github/forks/GDalforno/KNN-TSPI)\n![Repo Stars](https://img.shields.io/github/stars/GDalforno/KNN-TSPI)\n\n<image alt=\"logo.png\" src=\"https://raw.githubusercontent.com/GDalforno/KNN-TSPI/main/docs/images/logo.png\" width=\"150rem\"/>\n\nK-Nearest Neighbors Time Series Prediction with Invariances (KNN-TSPI) algorithm implementation in python. For details about the model access the [paper](https://www.researchgate.net/publication/300414605_A_Study_of_the_Use_of_Complexity_Measures_in_the_Similarity_Search_Process_Adopted_by_kNN_Algorithm_for_Time_Series_Prediction).\n\n## Installation\n\n### Dependencies\n\nThe package depends on the following third party libraries:\n\n- `numpy`\n\n### User Installation\n\nMake sure you have `pip` package manager installed in your environment, then run:\n\n```sh\npip install knn-tspi\n```\n\n## Getting Started\n\nOnce the package is installed successfully, you can import the `KNeighborsTSPI` class and start forecasting univariate time series in a scikit-learn like manner.\n\n```python\nimport numpy as np\n\nfrom knn_tspi import KNeighborsTSPI\n\n\ndata = 0.5 * np.arange(60) + np.random.randn(60)\n\nmodel = KNeighborsTSPI()\nmodel.fit(data)\n\ny = model.predict(h=5)\n```\n\nFor more detailed examples on how to use the package access [examples](https://github.com/GDalforno/KNN-TSPI/tree/main/examples).\n\n## Development\n\n### Source Code\n\nClone the repo with the command:\n\n```\ngit clone https://github.com/GDalforno/KNN-TSPI.git\n```\n\n### Setup\n\nCreate a python virtual environment and activate it with the command:\n\n```sh\npython3.11 -m venv .venv\nsource .venv/bin/activate\n```\n\nThen, set the enviroment up with the command:\n\n```sh\nmake setup-dev\n```\n\n### Testing\n\nOnce the setup is completed, launch the test suite for sanity check with:\n\n```sh\nmake test-dev\n```\n\n### Contributing\n\nYou can contributing to the project by opening issues, pull requests and reviewing the code. It will help us a lot if you reference the package on blog posts, articlesm social media, etc.\n\n## License\n\nThis project is licensed under the MIT License - see the [License](https://github.com/GDalforno/KNN-TSPI/blob/main/LICENSE.txt) file for details.\n\n## Changelog\n\nSee the [changelog](https://github.com/GDalforno/KNN-TSPI/blob/main/CHANGES.txt) for a history of notable changes to knn-tspi.\n\n## Project History\n\nDuring my research in the field of application of machine learning to forecast time series in 2020, I stumbled with a lack of algorithms and frameworks specialized in this task.\n\nOne of my colleagues, [Mois\u00e9s Rocha](https://github.com/moisesrsantos), send me the paper of a modified KNN for time series prediction along with the experiment code written in MATLAB to help me out with my work. A coupled of days after it, I managed to port the code to both python and R and created this repo to store the resulted files.\n\nThroughtout the years that followed, I have seen a growing interest in this repo, and now, I decided to publish it on pip to make it easier for people to include the model in their time series forecasting toolbox as I did a couple of years ago. As far as I know, there is no other implementation of the KNN-TSPI out there.\n\nI am not planning on creating a CRAN package to distribute the model for the R community anytime soon. With that being said, feel free to implement it yourself if you wish. The core R code can be found [here](https://github.com/GDalforno/KNN-TSPI/tree/main/legacy).\n\n## Communication\n\n- Linkedin: https://www.linkedin.com/in/gabriel-dalforno-7b47ba227/\n\n## References\n\n1. Parmezan, Antonio & Batista, Gustavo. (2015). A Study of the Use of Complexity Measures in the Similarity Search Process Adopted by kNN Algorithm for Time Series Prediction. 45-51. 10.1109/ICMLA.2015.217.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "K-Nearest Neighbors Time Series Prediction with Invariances",
"version": "1.0.1",
"project_urls": {
"Documentation": "https://github.com/GDalforno/KNN-TSPI/blob/main/README.md",
"Homepage": "https://pypi.org/project/knn-tspi/",
"Repository": "https://github.com/GDalforno/KNN-TSPI"
},
"split_keywords": [
"time series",
" forecasting",
" machine learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "abc7f1dadb07b2df4773609907fe90d2a49b6b240a4917444611a0f0404964df",
"md5": "91300efea82f2cfd1af76a3583d436e2",
"sha256": "5204e042c2ab1d460e07530405add1f3836d66d6a0311c9b30846904a85a41fb"
},
"downloads": -1,
"filename": "knn_tspi-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "91300efea82f2cfd1af76a3583d436e2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 10190,
"upload_time": "2024-05-29T21:15:52",
"upload_time_iso_8601": "2024-05-29T21:15:52.243008Z",
"url": "https://files.pythonhosted.org/packages/ab/c7/f1dadb07b2df4773609907fe90d2a49b6b240a4917444611a0f0404964df/knn_tspi-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bbabdb9a16d03789a4758a525e9d15f9a20c12ca2968fe636192e82fc5ae82cf",
"md5": "b7f03138098dafffb937dc08efbb32d4",
"sha256": "e5417b48842c0ddd6f439011a2cf52bfc50caf2398eda31ebdc668804a14a506"
},
"downloads": -1,
"filename": "knn_tspi-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "b7f03138098dafffb937dc08efbb32d4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 9652,
"upload_time": "2024-05-29T21:15:54",
"upload_time_iso_8601": "2024-05-29T21:15:54.231459Z",
"url": "https://files.pythonhosted.org/packages/bb/ab/db9a16d03789a4758a525e9d15f9a20c12ca2968fe636192e82fc5ae82cf/knn_tspi-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-29 21:15:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GDalforno",
"github_project": "KNN-TSPI",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "knn-tspi"
}