<p align="left">
<img width=15% src="https://dai.lids.mit.edu/wp-content/uploads/2018/06/Logo_DAI_highres.png" alt=“DAI-Lab” />
<i>An open source project from Data to AI Lab at MIT.</i>
</p>
[![Development Status](https://img.shields.io/badge/Development%20Status-2%20--%20Pre--Alpha-yellow)](https://pypi.org/search/?c=Development+Status+%3A%3A+2+-+Pre-Alpha)
[![Python](https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)](https://badge.fury.io/py/sigllm)
[![PyPi Shield](https://img.shields.io/pypi/v/sigllm.svg)](https://pypi.python.org/pypi/sigllm)
[![Run Tests](https://github.com/sintel-dev/sigllm/actions/workflows/tests.yml/badge.svg)](https://github.com/sintel-dev/sigllm/actions/workflows/tests.yml)
[![Downloads](https://pepy.tech/badge/sigllm)](https://pepy.tech/project/sigllm)
# SigLLM
Using Large Language Models (LLMs) for time series anomaly detection.
<!-- - Documentation: https://sintel-dev.github.io/sigllm -->
- Homepage: https://github.com/sintel-dev/sigllm
# Overview
SigLLM is an extension of the Orion library, built to detect anomalies in time series data using LLMs.
We provide two types of pipelines for anomaly detection:
* **Prompter**: directly prompting LLMs to find anomalies in time series.
* **Detector**: using LLMs to forecast time series and finding anomalies through by comparing the real and forecasted signals.
For more details on our pipelines, please read our [paper](https://arxiv.org/pdf/2405.14755).
# Quickstart
## Install with pip
The easiest and recommended way to install **SigLLM** is using [pip](https://pip.pypa.io/en/stable/):
```bash
pip install sigllm
```
This will pull and install the latest stable release from [PyPi](https://pypi.org/).
In the following example we show how to use one of the **SigLLM Pipelines**.
# Detect anomalies using a SigLLM pipeline
We will load a demo data located in `tutorials/data.csv` for this example:
```python3
import pandas as pd
data = pd.read_csv('data.csv')
data.head()
```
which should show a signal with `timestamp` and `value`.
```
timestamp value
0 1222840800 6.357008
1 1222862400 12.763547
2 1222884000 18.204697
3 1222905600 21.972602
4 1222927200 23.986643
5 1222948800 24.906765
```
In this example we use `gpt_detector` pipeline and set some hyperparameters. In this case, we set the thresholding strategy to dynamic. The hyperparameters are optional and can be removed.
In addtion, the `SigLLM` object takes in a `decimal` argument to determine how many digits from the float value include. Here, we don't want to keep any decimal values, so we set it to zero.
```python3
from sigllm import SigLLM
hyperparameters = {
"orion.primitives.timeseries_anomalies.find_anomalies#1": {
"fixed_threshold": False
}
}
sigllm = SigLLM(
pipeline='gpt_detector',
decimal=0,
hyperparameters=hyperparameters
)
```
Now that we have initialized the pipeline, we are ready to use it to detect anomalies:
```python3
anomalies = sigllm.detect(data)
```
> :warning: Depending on the length of your timeseries, this might take time to run.
The output of the previous command will be a ``pandas.DataFrame`` containing a table of detected anomalies:
```
start end severity
0 1225864800 1227139200 0.625879
```
# Resources
Additional resources that might be of interest:
* Learn about [Orion](https://github.com/sintel-dev/Orion).
* Read our [paper](https://arxiv.org/pdf/2405.14755).
# Citation
If you use **SigLLM** for your research, please consider citing the following paper:
Sarah Alnegheimish, Linh Nguyen, Laure Berti-Equille, Kalyan Veeramachaneni. [Can Large Language Models be Anomaly Detectors for Time Series?](https://arxiv.org/pdf/2405.14755).
```
@inproceedings{alnegheimish2024sigllm,
title={Can Large Language Models be Anomaly Detectors for Time Series?},
author={Alnegheimish, Sarah and Nguyen, Linh and Berti-Equille, Laure and Veeramachaneni, Kalyan},
booktitle={2024 IEEE International Conferencze on Data Science and Advanced Analytics (IEEE DSAA)},
organization={IEEE},
year={2024}
}
```
# History
## 0.0.2 - 2024-10-24
New Prompter pipeline.
* Test README with GPT – [Issue #20](https://github.com/sintel-dev/sigllm/issues/20) by @sarahmish
* Mistral-prompter – [Issue #19](https://github.com/sintel-dev/sigllm/issues/19) by @Linh-nk
## 0.0.1 - 2024-09-25
First sigllm release to PyPI: https://pypi.org/project/sigllm/
* Add README – [Issue #17](https://github.com/sintel-dev/sigllm/issues/17) by @sarahmish
* Create a SigLLM API – [Issue #13](https://github.com/sintel-dev/sigllm/issues/13) by @sarahmish
* Add a Quick Example – [Issue #12](https://github.com/sintel-dev/sigllm/issues/12) by @sarahmish
* Forecasting Pipeline – [Issue #11](https://github.com/sintel-dev/sigllm/issues/11) by @sarahmish
* Refactor Transformation Primitives – [Issue #7](https://github.com/sintel-dev/sigllm/issues/7) by @sarahmish
* Forecasting Module – [Issue #2](https://github.com/sintel-dev/sigllm/issues/2) by @sarahmish
Raw data
{
"_id": null,
"home_page": "https://github.com/sintel-dev/sigllm",
"name": "sigllm",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.12,>=3.8",
"maintainer_email": null,
"keywords": "sigllm sigllm sigllm",
"author": "MIT Data To AI Lab",
"author_email": "dailabmit@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4d/f6/b35ebc73284e9c32874baabc60231a2e41411ab33439ec24b76487c0bafd/sigllm-0.0.2.tar.gz",
"platform": null,
"description": "<p align=\"left\">\n<img width=15% src=\"https://dai.lids.mit.edu/wp-content/uploads/2018/06/Logo_DAI_highres.png\" alt=\u201cDAI-Lab\u201d />\n<i>An open source project from Data to AI Lab at MIT.</i>\n</p>\n\n[![Development Status](https://img.shields.io/badge/Development%20Status-2%20--%20Pre--Alpha-yellow)](https://pypi.org/search/?c=Development+Status+%3A%3A+2+-+Pre-Alpha)\n[![Python](https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)](https://badge.fury.io/py/sigllm) \n[![PyPi Shield](https://img.shields.io/pypi/v/sigllm.svg)](https://pypi.python.org/pypi/sigllm)\n[![Run Tests](https://github.com/sintel-dev/sigllm/actions/workflows/tests.yml/badge.svg)](https://github.com/sintel-dev/sigllm/actions/workflows/tests.yml)\n[![Downloads](https://pepy.tech/badge/sigllm)](https://pepy.tech/project/sigllm)\n\n\n# SigLLM\n\nUsing Large Language Models (LLMs) for time series anomaly detection.\n\n<!-- - Documentation: https://sintel-dev.github.io/sigllm -->\n- Homepage: https://github.com/sintel-dev/sigllm\n\n# Overview\n\nSigLLM is an extension of the Orion library, built to detect anomalies in time series data using LLMs.\nWe provide two types of pipelines for anomaly detection:\n* **Prompter**: directly prompting LLMs to find anomalies in time series.\n* **Detector**: using LLMs to forecast time series and finding anomalies through by comparing the real and forecasted signals.\n\nFor more details on our pipelines, please read our [paper](https://arxiv.org/pdf/2405.14755).\n\n# Quickstart\n\n## Install with pip\n\nThe easiest and recommended way to install **SigLLM** is using [pip](https://pip.pypa.io/en/stable/):\n\n```bash\npip install sigllm\n```\nThis will pull and install the latest stable release from [PyPi](https://pypi.org/).\n\n\nIn the following example we show how to use one of the **SigLLM Pipelines**.\n\n# Detect anomalies using a SigLLM pipeline\n\nWe will load a demo data located in `tutorials/data.csv` for this example:\n\n```python3\nimport pandas as pd\n\ndata = pd.read_csv('data.csv')\ndata.head()\n```\n\nwhich should show a signal with `timestamp` and `value`.\n```\n timestamp value\n0 1222840800 6.357008\n1 1222862400 12.763547\n2 1222884000 18.204697\n3 1222905600 21.972602\n4 1222927200 23.986643\n5 1222948800 24.906765\n```\n\nIn this example we use `gpt_detector` pipeline and set some hyperparameters. In this case, we set the thresholding strategy to dynamic. The hyperparameters are optional and can be removed.\n\nIn addtion, the `SigLLM` object takes in a `decimal` argument to determine how many digits from the float value include. Here, we don't want to keep any decimal values, so we set it to zero.\n\n```python3\nfrom sigllm import SigLLM\n\nhyperparameters = {\n \"orion.primitives.timeseries_anomalies.find_anomalies#1\": {\n \"fixed_threshold\": False\n }\n}\n\nsigllm = SigLLM(\n pipeline='gpt_detector',\n decimal=0,\n hyperparameters=hyperparameters\n)\n```\n\nNow that we have initialized the pipeline, we are ready to use it to detect anomalies:\n\n```python3\nanomalies = sigllm.detect(data)\n```\n> :warning: Depending on the length of your timeseries, this might take time to run.\n\nThe output of the previous command will be a ``pandas.DataFrame`` containing a table of detected anomalies:\n\n```\n start end severity\n0 1225864800 1227139200 0.625879\n```\n\n# Resources\n\nAdditional resources that might be of interest:\n* Learn about [Orion](https://github.com/sintel-dev/Orion).\n* Read our [paper](https://arxiv.org/pdf/2405.14755).\n\n\n# Citation\n\nIf you use **SigLLM** for your research, please consider citing the following paper:\n\nSarah Alnegheimish, Linh Nguyen, Laure Berti-Equille, Kalyan Veeramachaneni. [Can Large Language Models be Anomaly Detectors for Time Series?](https://arxiv.org/pdf/2405.14755).\n\n```\n@inproceedings{alnegheimish2024sigllm,\n title={Can Large Language Models be Anomaly Detectors for Time Series?},\n author={Alnegheimish, Sarah and Nguyen, Linh and Berti-Equille, Laure and Veeramachaneni, Kalyan},\n booktitle={2024 IEEE International Conferencze on Data Science and Advanced Analytics (IEEE DSAA)},\n organization={IEEE},\n year={2024}\n}\n```\n\n# History\n\n## 0.0.2 - 2024-10-24\n\nNew Prompter pipeline.\n\n* Test README with GPT \u2013 [Issue #20](https://github.com/sintel-dev/sigllm/issues/20) by @sarahmish\n* Mistral-prompter \u2013 [Issue #19](https://github.com/sintel-dev/sigllm/issues/19) by @Linh-nk\n\n\n## 0.0.1 - 2024-09-25\n\nFirst sigllm release to PyPI: https://pypi.org/project/sigllm/\n\n* Add README \u2013 [Issue #17](https://github.com/sintel-dev/sigllm/issues/17) by @sarahmish\n* Create a SigLLM API \u2013 [Issue #13](https://github.com/sintel-dev/sigllm/issues/13) by @sarahmish\n* Add a Quick Example \u2013 [Issue #12](https://github.com/sintel-dev/sigllm/issues/12) by @sarahmish\n* Forecasting Pipeline \u2013 [Issue #11](https://github.com/sintel-dev/sigllm/issues/11) by @sarahmish\n* Refactor Transformation Primitives \u2013 [Issue #7](https://github.com/sintel-dev/sigllm/issues/7) by @sarahmish\n* Forecasting Module \u2013 [Issue #2](https://github.com/sintel-dev/sigllm/issues/2) by @sarahmish\n\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Signals plus LLMs",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/sintel-dev/sigllm"
},
"split_keywords": [
"sigllm",
"sigllm",
"sigllm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "116531bbfceffc89c9769d1638e7f06d36e75f0ad42fde84ed5f5ecdcda8a3df",
"md5": "6e3bcbf3d2d46af0c9bcffdd724afaed",
"sha256": "9491107e2301461bce20af2d71c23262e59cb639abf7b29bd80225ea72fe6acf"
},
"downloads": -1,
"filename": "sigllm-0.0.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "6e3bcbf3d2d46af0c9bcffdd724afaed",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "<3.12,>=3.8",
"size": 35416,
"upload_time": "2024-10-24T16:18:52",
"upload_time_iso_8601": "2024-10-24T16:18:52.965967Z",
"url": "https://files.pythonhosted.org/packages/11/65/31bbfceffc89c9769d1638e7f06d36e75f0ad42fde84ed5f5ecdcda8a3df/sigllm-0.0.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4df6b35ebc73284e9c32874baabc60231a2e41411ab33439ec24b76487c0bafd",
"md5": "fab6a30bee9b615bbcbeeb1a62046aa5",
"sha256": "2a03a1426e887f9a32d80b01c729f1ce6ff9a573805cd208337b92878201cc52"
},
"downloads": -1,
"filename": "sigllm-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "fab6a30bee9b615bbcbeeb1a62046aa5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.8",
"size": 69161,
"upload_time": "2024-10-24T16:18:54",
"upload_time_iso_8601": "2024-10-24T16:18:54.416365Z",
"url": "https://files.pythonhosted.org/packages/4d/f6/b35ebc73284e9c32874baabc60231a2e41411ab33439ec24b76487c0bafd/sigllm-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-24 16:18:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sintel-dev",
"github_project": "sigllm",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "sigllm"
}