torchchronos


Nametorchchronos JSON
Version 0.0.3.post2 PyPI version JSON
download
home_pagehttps://github.com/mauricekraus/torchchronos
SummaryPyTorch and Lightning compatible library that provides easy and flexible access to various time-series datasets for classification and regression tasks
upload_time2023-08-25 15:26:33
maintainer
docs_urlNone
authorMaurice Kraus
requires_python>=3.10,<3.12
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # torchchronos

[![PyPI version](https://img.shields.io/pypi/v/torchchronos.svg?color=blue)](https://pypi.org/project/torchchronos)
[![license](https://img.shields.io/pypi/l/torchchronos.svg?color=blue)](https://github.com/mauricekraus/torchchronos/blob/main/LICENSE)
[![python version](https://img.shields.io/badge/python-3.10+-blue)](https://devguide.python.org/versions/)

[![test](https://github.com/mauricekraus/torchchronos/actions/workflows/main.yml/badge.svg)](https://github.com/mauricekraus/torchchronos/actions/workflows/main.yml)
[![code style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black)

*torchchronos* is an experimental [PyTorch](https://pytorch.org/) and [Lightning](https://lightning.ai/pytorch-lightning/) compatible library that provides easy and flexible access to various time-series datasets for classification and regression tasks. It also provides a simple and extensible transform API to preprocess data.
It is inspired by the much more complicated [torchtime](https://github.com/philipdarke/torchtime).

## Installation
You can install torchchronos via pip:

`pip install torchchronos`

## Usage
### Datasets
torchchronos currently provides access to several popular time-series datasets, including:

- [UCR/UEA Time Series Classification Repository](https://www.timeseriesclassification.com/): `torchchronos.datasets.UCRUEADataset`
- Time series as preprocessed in the [TFC paper](https://github.com/mims-harvard/TFC-pretraining): `torchchronos.datasets.TFCPretrainDataset` (datasets `Gesture` and `EMG`)

To use a dataset, you can simply import the corresponding dataset class and create an instance:

```python
from torchchronos.datasets import UCRUEADataset
from torchchronos.transforms import PadFront
from torchchronos.download import download_uea_ucr

download_uea_ucr("ECG5000",Path(".cache/data"))
dataset = UCRUEADataset('ECG5000', path=Path(".cache") / "data", transforms=PadFront(10))
```

### Data Modules
torchchronos also provides [Lightning compatible `DataModules`](https://lightning.ai/docs/pytorch/stable/data/datamodule.html) to make it easy to load and preprocess data. They support common use cases like (multi-)GPU training and train/test/val-splitting out of the box. For example:

```python
from torchchronos.lightning import UCRUEADataModule
from torchchronos.transforms import PadFront, PadBack

module = UCRUEAModule('ECG5000', split_ratio= (0.75, 0.15), batch_size= 32,
                      transforms=Compose([PadFront(10), PadBack(10)]))
```

Analogous the the datasets above, these dataloaders are supported as of now, wrapping the respective datasets:
- `torchchronos.lightning.UCRUEADataModule`
- `torchchronos.lightning.TFCPretrainDataModule`

### Transforms
torchchronos provides a flexible transform API to preprocess time-series data. For example, to normalize a dataset, you can define a custom `Transform` like this:

```python
from torchchronos.transforms import Transform

class Normalize(Transform):
    def __init__(self, mean=None, std=None):
        self.mean = mean
        self.std = std

    def fit(self, data) -> Self:
        self.mean = data.mean()
        self.std = data.std()
        return self

    def __call__(self, data):
        return (data - self.mean) / self.std
```

## Known issues
- The dataset [SpokenArabicDigits](https://www.timeseriesclassification.com/description.php?Dataset=SpokenArabicDigits) does not seem to work due to a missmatch of TRAIN and TEST size
- The dataset [UrbanSound](https://www.timeseriesclassification.com/description.php?Dataset=UrbanSound) does not seem to work due to missing ts files


## Roadmap
The following features are planned for future releases of torchchronos:

- Support for additional time-series datasets, including:
    - Energy consumption dataset
    - Traffic dataset
    - PhysioNet Challenge 2012 (in-hospital mortality)
    - PhysioNet Challenge 2019 (sepsis prediction) datasets
- Additional transform classes, including:
    - Resampling
    - Missing value imputation

If you have any feature requests or suggestions, please open an issue on our GitHub page.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mauricekraus/torchchronos",
    "name": "torchchronos",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<3.12",
    "maintainer_email": "",
    "keywords": "",
    "author": "Maurice Kraus",
    "author_email": "dev@mkraus.io",
    "download_url": "https://files.pythonhosted.org/packages/35/45/88ade79ab2acca40e01cb127a949978e37c829e8a660e1beb5ee87254186/torchchronos-0.0.3.post2.tar.gz",
    "platform": null,
    "description": "# torchchronos\n\n[![PyPI version](https://img.shields.io/pypi/v/torchchronos.svg?color=blue)](https://pypi.org/project/torchchronos)\n[![license](https://img.shields.io/pypi/l/torchchronos.svg?color=blue)](https://github.com/mauricekraus/torchchronos/blob/main/LICENSE)\n[![python version](https://img.shields.io/badge/python-3.10+-blue)](https://devguide.python.org/versions/)\n\n[![test](https://github.com/mauricekraus/torchchronos/actions/workflows/main.yml/badge.svg)](https://github.com/mauricekraus/torchchronos/actions/workflows/main.yml)\n[![code style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black)\n\n*torchchronos* is an experimental [PyTorch](https://pytorch.org/) and [Lightning](https://lightning.ai/pytorch-lightning/) compatible library that provides easy and flexible access to various time-series datasets for classification and regression tasks. It also provides a simple and extensible transform API to preprocess data.\nIt is inspired by the much more complicated [torchtime](https://github.com/philipdarke/torchtime).\n\n## Installation\nYou can install torchchronos via pip:\n\n`pip install torchchronos`\n\n## Usage\n### Datasets\ntorchchronos currently provides access to several popular time-series datasets, including:\n\n- [UCR/UEA Time Series Classification Repository](https://www.timeseriesclassification.com/): `torchchronos.datasets.UCRUEADataset`\n- Time series as preprocessed in the [TFC paper](https://github.com/mims-harvard/TFC-pretraining): `torchchronos.datasets.TFCPretrainDataset` (datasets `Gesture` and `EMG`)\n\nTo use a dataset, you can simply import the corresponding dataset class and create an instance:\n\n```python\nfrom torchchronos.datasets import UCRUEADataset\nfrom torchchronos.transforms import PadFront\nfrom torchchronos.download import download_uea_ucr\n\ndownload_uea_ucr(\"ECG5000\",Path(\".cache/data\"))\ndataset = UCRUEADataset('ECG5000', path=Path(\".cache\") / \"data\", transforms=PadFront(10))\n```\n\n### Data Modules\ntorchchronos also provides [Lightning compatible `DataModules`](https://lightning.ai/docs/pytorch/stable/data/datamodule.html) to make it easy to load and preprocess data. They support common use cases like (multi-)GPU training and train/test/val-splitting out of the box. For example:\n\n```python\nfrom torchchronos.lightning import UCRUEADataModule\nfrom torchchronos.transforms import PadFront, PadBack\n\nmodule = UCRUEAModule('ECG5000', split_ratio= (0.75, 0.15), batch_size= 32,\n                      transforms=Compose([PadFront(10), PadBack(10)]))\n```\n\nAnalogous the the datasets above, these dataloaders are supported as of now, wrapping the respective datasets:\n- `torchchronos.lightning.UCRUEADataModule`\n- `torchchronos.lightning.TFCPretrainDataModule`\n\n### Transforms\ntorchchronos provides a flexible transform API to preprocess time-series data. For example, to normalize a dataset, you can define a custom `Transform` like this:\n\n```python\nfrom torchchronos.transforms import Transform\n\nclass Normalize(Transform):\n    def __init__(self, mean=None, std=None):\n        self.mean = mean\n        self.std = std\n\n    def fit(self, data) -> Self:\n        self.mean = data.mean()\n        self.std = data.std()\n        return self\n\n    def __call__(self, data):\n        return (data - self.mean) / self.std\n```\n\n## Known issues\n- The dataset [SpokenArabicDigits](https://www.timeseriesclassification.com/description.php?Dataset=SpokenArabicDigits) does not seem to work due to a missmatch of TRAIN and TEST size\n- The dataset [UrbanSound](https://www.timeseriesclassification.com/description.php?Dataset=UrbanSound) does not seem to work due to missing ts files\n\n\n## Roadmap\nThe following features are planned for future releases of torchchronos:\n\n- Support for additional time-series datasets, including:\n    - Energy consumption dataset\n    - Traffic dataset\n    - PhysioNet Challenge 2012 (in-hospital mortality)\n    - PhysioNet Challenge 2019 (sepsis prediction) datasets\n- Additional transform classes, including:\n    - Resampling\n    - Missing value imputation\n\nIf you have any feature requests or suggestions, please open an issue on our GitHub page.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PyTorch and Lightning compatible library that provides easy and flexible access to various time-series datasets for classification and regression tasks",
    "version": "0.0.3.post2",
    "project_urls": {
        "Homepage": "https://github.com/mauricekraus/torchchronos"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "81f4212be10e892dee365316bdd45d1c322031296cf3f63a9027bb61ee1b12a7",
                "md5": "b8266f3e9f7217b7be6443748e87065b",
                "sha256": "88e4718ff6e1d29f345c072ff98e2a792f686af43a859bccc596675e9c1d56b9"
            },
            "downloads": -1,
            "filename": "torchchronos-0.0.3.post2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b8266f3e9f7217b7be6443748e87065b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<3.12",
            "size": 13489,
            "upload_time": "2023-08-25T15:26:32",
            "upload_time_iso_8601": "2023-08-25T15:26:32.375516Z",
            "url": "https://files.pythonhosted.org/packages/81/f4/212be10e892dee365316bdd45d1c322031296cf3f63a9027bb61ee1b12a7/torchchronos-0.0.3.post2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "354588ade79ab2acca40e01cb127a949978e37c829e8a660e1beb5ee87254186",
                "md5": "cb8bfd3a7eb45965794688e8eb965d9b",
                "sha256": "471f287fb37eee8c8a6d0b0fe91140d4e9255c3c1ed32a47103ffb2899094149"
            },
            "downloads": -1,
            "filename": "torchchronos-0.0.3.post2.tar.gz",
            "has_sig": false,
            "md5_digest": "cb8bfd3a7eb45965794688e8eb965d9b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<3.12",
            "size": 10781,
            "upload_time": "2023-08-25T15:26:33",
            "upload_time_iso_8601": "2023-08-25T15:26:33.422192Z",
            "url": "https://files.pythonhosted.org/packages/35/45/88ade79ab2acca40e01cb127a949978e37c829e8a660e1beb5ee87254186/torchchronos-0.0.3.post2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-25 15:26:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mauricekraus",
    "github_project": "torchchronos",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "torchchronos"
}
        
Elapsed time: 0.10616s