A Python package for time series augmentation

Overview

tsaug

Build Status Documentation Status Coverage Status PyPI Downloads Code style: black

tsaug is a Python package for time series augmentation. It offers a set of augmentation methods for time series, as well as a simple API to connect multiple augmenters into a pipeline.

See https://tsaug.readthedocs.io complete documentation.

Installation

Prerequisites: Python 3.5 or later.

It is recommended to install the most recent stable release of tsaug from PyPI.

pip install tsaug

Alternatively, you could install from source code. This will give you the latest, but unstable, version of tsaug.

git clone https://github.com/arundo/tsaug.git
cd tsaug/
git checkout develop
pip install ./

Examples

A first-time user may start with two examples:

Examples of every individual augmenter can be found here

For full references of implemented augmentation methods, please refer to References.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Please see Contributing for more details.

License

tsaug is licensed under the Apache License 2.0. See the LICENSE file for details.

Comments
  • How to cite this repo?

    How to cite this repo?

    Basically the title. I used this awesome repo and I would like to cite this repo in my paper. How to do it. If you could provide a bibtex entry that will be great

    question 
    opened by kowshikthopalli 2
  • Default _Augmentor arguments will raise an error

    Default _Augmentor arguments will raise an error

    While working on #1 I found that the default args for initializing an _Augmentor object could lead to the code trying to call None when expecting a function.

    See: https://github.com/arundo/tsaug/blob/ebf1955664991fe51f038a5cc8506f1bfc849d91/src/tsaug/augmentor.py#L5 https://github.com/arundo/tsaug/blob/ebf1955664991fe51f038a5cc8506f1bfc849d91/src/tsaug/augmentor.py#L6

    and

    https://github.com/arundo/tsaug/blob/ebf1955664991fe51f038a5cc8506f1bfc849d91/src/tsaug/augmentor.py#L47

    I know that it's not intended to be initialized without an augmenter function, function, but I was wondering if you want to explicitly prevent an error here.

    Or is something else supposed to be happening?

    bug 
    opened by roycoding 1
  • can't find the deepad python package

    can't find the deepad python package

    In the quickstart notebook https://github.com/arundo/tsaug/blob/master/docs/quickstart.ipynb from deepad.visualization import plot where can you find the deepad package to install?

    opened by xsqian 1
  • Missing function calls in documentation

    Missing function calls in documentation

    Hi!

    I noticed that documentation is actually missing few important notes.

    For instance, first example contains such snippet:

    >>> import numpy as np
    >>> X = np.load("./X.npy")
    >>> Y = np.load("./Y.npy")
    >>> from tsaug.visualization import plot
    >>> plot(X, Y)
    

    and shows a chart which suggests that it is immediately rendered after calling plot function.

    In configurations I've seen and worked on, plot function does not render any chart immediately. Instead it returns Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]. This means that we need to take first element of returned tuple and call .show() on it, so this example should rather be:

    >>> import numpy as np
    >>> X = np.load("./X.npy")
    >>> Y = np.load("./Y.npy")
    >>> from tsaug.visualization import plot
    >>> figure, _ = plot(X, Y)
    >>> figure.show()
    

    I can create a push request with such corrections if you're open for contribution

    opened by 15bubbles 0
  • Static random augmentation across multiple time series

    Static random augmentation across multiple time series

    Hello,

    I have a use case where I apply temporal augmentation with the same random anchor across multiple time series within a segmented object. I.e., I want certain augmentations to vary across objects, but remain constant within objects.

    In TimeWarp, e.g., I've added an optional keyword argument (static_rand):

        def __init__(
             self,
             n_speed_change: int = 3,
             max_speed_ratio: Union[float, Tuple[float, float], List[float]] = 3.0,
             repeats: int = 1,
             prob: float = 1.0,
             seed: Optional[int] = _default_seed,
             static_rand: Optional[bool] = False
         ):
    

    which is used by:

             if self.static_rand:                                                                                                                      
                 anchor_values = rand.uniform(low=0.0, high=1.0, size=self.n_speed_change + 1)
                 anchor_values = np.tile(anchor_values, (N, 1))
             else:
                 anchor_values = rand.uniform(
                     low=0.0, high=1.0, size=(N, self.n_speed_change + 1)
                 )
    

    Thus, instead of having N time series with different random anchor_values, I generate N time series with the same anchor value.

    I use this approach with TimeWarp and Drift. Would this be of any interest as a PR, or does it sound too specific?

    Thanks for the nice library.

    opened by jgrss 0
  • _Augmenter should be exposed properly as tsaug.Augmenter

    _Augmenter should be exposed properly as tsaug.Augmenter

    Might be related to https://github.com/arundo/tsaug/issues/1

    In the current state of the package, the _Augmenter class is an internal class that should not be used outside of the package itself... but it's also the base class for all usable classes from tsaug. This makes it very weird to type "generic" functions outside of tsaug, e.g.

    # this should not appear in a normal Python code
    from tsaug._augmenters.base import _Augmenter
    
    def apply_transformation(aug: _Augmenter):
        ...
    

    The _Augmenter class should be exposed as tsaug.Augmenter so that it can be used for proper typing outside of the tsaug package.

    help wanted 
    opened by Holt59 0
  • Equivalence in transformation names

    Equivalence in transformation names

    Hello

    I'm very interested to use and apply Tsaug library in my personal project.

    I have read the paper "Data Augmentation ofWearable Sensor Data for Parkinson’s Disease Monitoring using Convolutional Neural Networks" and I'm quite confused about the name of the transformations.

    What are the equivalent in TSAUG library for the transformations Jittering, Scaling, rotation, permutation, MagWarp mentioned in this paper?

    Also, I have read the blog "https://www.arundo.com/arundo_tech_blog/tsaug-an-open-source-python-package-for-time-series-augmentation", and I didn´t find the equivalent for RandomMagnify, RandomJitter, etc.

    Could you help me with these doubts.

    Best regards

    Oscar

    question 
    opened by ogreyesp 1
  • ValueError: The numbers of series in X and Y are different.

    ValueError: The numbers of series in X and Y are different.

    The shape of X is (54, 337) and the shape of y is (54,). But I am getting error. I am using the following code

    from tsaug import TimeWarp, Crop, Quantize, Drift, Reverse
    my_augmenter = (
        TimeWarp() * 5  # random time warping 5 times in parallel
        + Crop(size=300)  # random crop subsequences with length 300
        + Quantize(n_levels=[10, 20, 30])  # random quantize to 10-, 20-, or 30- level sets
        + Drift(max_drift=(0.1, 0.5)) @ 0.8  # with 80% probability, random drift the signal up to 10% - 50%
        + Reverse() @ 0.5  # with 50% probability, reverse the sequence
    )
    data, labels = my_augmenter.augment(data, labels)
    
    question 
    opened by talhaanwarch 3
  • How to augment multi_variate time series data?

    How to augment multi_variate time series data?

    I noticed that while augmenting multi-variate time series data, augmented data is concatenated on 0 axes, instead of being added to a new axis ie third axis. Let suppose data shape is (18,1000), after augmentation it turns to be (72,1000), but i believe it should be (4,18,1000). simply reshaping data.reshape(4,18,1000) resolve the problem or not?

    question 
    opened by talhaanwarch 2
Releases(v0.2.1)
Face Transformer for Recognition

Face-Transformer This is the code of Face Transformer for Recognition (https://arxiv.org/abs/2103.14803v2). Recently there has been great interests of

Zhong Yaoyao 153 Nov 30, 2022
A TensorFlow Implementation of "Deep Multi-Scale Video Prediction Beyond Mean Square Error" by Mathieu, Couprie & LeCun.

Adversarial Video Generation This project implements a generative adversarial network to predict future frames of video, as detailed in "Deep Multi-Sc

Matt Cooper 704 Nov 26, 2022
Semi-supervised Implicit Scene Completion from Sparse LiDAR

Semi-supervised Implicit Scene Completion from Sparse LiDAR Paper Created by Pengfei Li, Yongliang Shi, Tianyu Liu, Hao Zhao, Guyue Zhou and YA-QIN ZH

114 Nov 30, 2022
Domain Generalization with MixStyle, ICLR'21.

MixStyle This repo contains the code of our ICLR'21 paper, "Domain Generalization with MixStyle". The OpenReview link is https://openreview.net/forum?

Kaiyang 208 Dec 28, 2022
A FAIR dataset of TCV experimental results for validating edge/divertor turbulence models.

TCV-X21 validation for divertor turbulence simulations Quick links Intro Welcome to TCV-X21. We're glad you've found us! This repository is designed t

0 Dec 18, 2021
Code to reproduce the results for Compositional Attention

Compositional-Attention This repository contains the official implementation for the paper Compositional Attention: Disentangling Search and Retrieval

Sarthak Mittal 58 Nov 30, 2022
Reinforcement Learning for Portfolio Management

qtrader Reinforcement Learning for Portfolio Management Why Reinforcement Learning? Learns the optimal action, rather than models the market. Adaptive

Angelos Filos 406 Jan 01, 2023
Code for WSDM 2022 paper, Contrastive Learning for Representation Degeneration Problem in Sequential Recommendation.

DuoRec Code for WSDM 2022 paper, Contrastive Learning for Representation Degeneration Problem in Sequential Recommendation. Usage Download datasets fr

Qrh 46 Dec 19, 2022
A package for music online and offline rhythmic information analysis including music Beat, downbeat, tempo and meter tracking.

BeatNet A package for music online and offline rhythmic information analysis including music Beat, downbeat, tempo and meter tracking. This repository

Mojtaba Heydari 157 Dec 27, 2022
Official PyTorch implementation of PICCOLO: Point-Cloud Centric Omnidirectional Localization (ICCV 2021)

Official PyTorch implementation of PICCOLO: Point-Cloud Centric Omnidirectional Localization (ICCV 2021)

16 Nov 19, 2022
DecoupledNet is semantic segmentation system which using heterogeneous annotations

DecoupledNet: Decoupled Deep Neural Network for Semi-supervised Semantic Segmentation Created by Seunghoon Hong, Hyeonwoo Noh and Bohyung Han at POSTE

Hyeonwoo Noh 74 Sep 22, 2021
Codebase for arXiv preprint "NeRF++: Analyzing and Improving Neural Radiance Fields"

NeRF++ Codebase for arXiv preprint "NeRF++: Analyzing and Improving Neural Radiance Fields" Work with 360 capture of large-scale unbounded scenes. Sup

Kai Zhang 722 Dec 28, 2022
Is RobustBench/AutoAttack a suitable Benchmark for Adversarial Robustness?

Adversrial Machine Learning Benchmarks This code belongs to the papers: Is RobustBench/AutoAttack a suitable Benchmark for Adversarial Robustness? Det

Adversarial Machine Learning 9 Nov 27, 2022
A PyTorch Lightning solution to training OpenAI's CLIP from scratch.

train-CLIP 📎 A PyTorch Lightning solution to training CLIP from scratch. Goal ⚽ Our aim is to create an easy to use Lightning implementation of OpenA

Cade Gordon 396 Dec 30, 2022
Functional deep learning

Pipeline abstractions for deep learning. Full documentation here: https://lf1-io.github.io/padl/ PADL: is a pipeline builder for PyTorch. may be used

LF1 101 Nov 09, 2022
Neural-Pull: Learning Signed Distance Functions from Point Clouds by Learning to Pull Space onto Surfaces(ICML 2021)

Neural-Pull: Learning Signed Distance Functions from Point Clouds by Learning to Pull Space onto Surfaces(ICML 2021) This repository contains the code

149 Dec 15, 2022
An self sufficient AI that crawls the web to learn how to generate art from keywords

Roxx-IO - The Smart Artist AI! TO DO / IDEAS Implement Web-Scraping Functionality Figure out a less annoying (and an off button for it) text to speech

Tatz 5 Mar 21, 2022
Code for `BCD Nets: Scalable Variational Approaches for Bayesian Causal Discovery`, Neurips 2021

This folder contains the code for 'Scalable Variational Approaches for Bayesian Causal Discovery'. Installation To install, use conda with conda env c

14 Sep 21, 2022
Python script to download the celebA-HQ dataset from google drive

download-celebA-HQ Python script to download and create the celebA-HQ dataset. WARNING from the author. I believe this script is broken since a few mo

133 Dec 21, 2022
The Most Efficient Temporal Difference Learning Framework for 2048

moporgic/TDL2048+ TDL2048+ is a highly optimized temporal difference (TD) learning framework for 2048. Features Many common methods related to 2048 ar

Hung Guei 5 Nov 23, 2022