Skip to main content

Dynamic time warping metrics.

Project description

dtw_metrics

Dynamic time warping metrics.

python 3.11 pre-commit pre-commit.ci status linter Code style: black Imports: isort pydocstyle License: MIT

Description

Dynamic time warping (DTW) is an algorithm used to measure similarity between different data series, which may vary in speed.

Setup

Makefile

Setup via Makefile:

  • Clone the repository first.

  • Help and overview of commands:

    make help
    
  • Setup (Create the venv, install libraries and pull minimal data setup):

    make setup
    
  • Activate Python venv:

    make venv
    
  • Clean project:

    make clean
    

Python venv (Poetry)

  • Poetry is used for the virtual Python environment.
    • Install python poetry:

      curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
      

      or

      pip install --user poetry
      
    • Make sure that the virtual environment is installed in the root folder of this projects:

      poetry config virtualenvs.in-project true
      
    • Install dependencies:

      poetry install --no-root
      
    • Add packages: To add further packages, run:

      poetry add <package-name>
      

Code formatting

  • Formatting via pre-commit hook: Python code is formatted using pre-commit hooks.

  • Install pre-commit:

    pip install pre-commit
    

    or

    brew install pre-commit
    
  • Install pre-commit hooks from the config file .pre-commit-config.yaml

    pre-commit install
    
  • Run the pre-commit hooks:

    pre-commit run -a
    

Code testing

Testing is done with pytest. The pytest package is already installed in the poetry venv.

  • Run all tests:

    pytest
    
  • Run individual tests:

    pytest <path-to-test-files>
    

Usage

  • Example files in /examples/

Examples

Symmetric P1 step pattern

Example image Fig 1: Compared time series and warped sequence.

Example image Fig 2: Cost matrix and optimal warping path.

Example image Fig 3: Accumulated cost matrix and optimal warping path.

Symmetric P0 step pattern

Example image Fig 1: Compared time series and warped sequence.

Example image Fig 2: Cost matrix and optimal warping path.

Example image Fig 3: Accumulated cost matrix and optimal warping path.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtwmetrics-0.1.2.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

dtwmetrics-0.1.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file dtwmetrics-0.1.2.tar.gz.

File metadata

  • Download URL: dtwmetrics-0.1.2.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for dtwmetrics-0.1.2.tar.gz
Algorithm Hash digest
SHA256 883ea6ede744edaf4397564c72c4e28483090aa2a64fd5c69951567e24e66b13
MD5 68808013910002f89f3062a3ce722665
BLAKE2b-256 31cac4a4d2df5edd41c081fa106e4eeb230e0f87f94e85efb862d123c9c4d367

See more details on using hashes here.

File details

Details for the file dtwmetrics-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dtwmetrics-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for dtwmetrics-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d78e83d0eef4ae088e9a922d91374662b86c6ac685f2677d7d8296f037b9c1e5
MD5 386b4bb193fd3a6ef4068180ae54775b
BLAKE2b-256 61e6326a7f8c917faecb8c2d028f6f3c1e1a151f34a275acd97c5b43bb56c339

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page