Visualization of Elastic Warping of Time Series Data
Project description
Elastic Warping Visualization For Time Series
Author
- Ali Ismail-Fawaz (hadifawaz1999)
This repository contains a project for visualizing warping distortions such as the ones produced by Dynamic Time Warping (DTW) between two time series. The project includes functions to generate plots and animated MP4s showcasing the alignment between the series. The repository is configured using Hydra for flexible and organized parameter management, and aeon-toolkit for all time series processing and similarity measure calculation.
Contents
main.py
: The main script to run the DTW visualization.draw_functions.py
: Contains the functions for generating plots and MP4s.utils.py
: Utility functions used in the project.config/config_hydra.yaml
: Configuration file for Hydra.
Usage
PyPi Package
Simply install the package as such pip install elastic_warping_vis
and then use it as follows:
from elastic_warping_vis.utils import load_data
from elastic_warping_vis.draw_functions import draw_elastic_gif, draw_elastic
# ignore third output, used for dev version
X, y, _ = load_data(name="ECG200", split="train", znormalize=True)
draw_elastic(x, y, metric="dtw")
draw_elastic_gif(x, y, metric="dtw")
Prerequisites
- Python >= 3.10
- Required Python libraries:
numpy==1.26.4
matplotlib==3.9.0
hydra-core==1.3.2
aeon==0.10.0
- Required on the system:
ffmpeg
version4.4.2
Running the Code
- Configure the parameters in
config/config_hydra.yaml
as needed. - Run the main script:
python3 main.py
Configuration Parameters
The following parameters can be configured in the config/config_hydra.yaml
file:
-
Hydra Configuration:
hydra.job.name
: Name of the job (default:dtw-vis
).hydra.run.dir
: Directory to save experiment results (default:exps/${hydra.job.name}
).
-
General Parameters:
output_dir
: Directory where output plots and MP4s will be saved (default:./
).dataset
: Name of the dataset to use (default:ItalyPowerDemand
) loaded from aeon-toolkit, see the classification dataset list and the regression datasets list, works with both univariate and multivariate time series datasets.split
: Dataset split (default:None
).znormalize
: Whether to Z-normalize the time series (default:True
).class_x
: Class label for the first time series (default:0
).class_y
: Class label for the second time series (default:1
).show_warping
: Whether to show warping connections in the plot (default:False
).figsize
: Figure size for the plots (default:[12, 10]
).
-
Metric Parameters:
metric
: Metric used for elastic warping calculation (default:dtw
), see aeon's list of elastic measures.metric_params
: Additional parameters for the DTW metric, including:window
: Window size for the Sakoe-Chiba band (default:None
).p
: Parameter for p-norm (default:2.0
).w
: Window size (default:None
).itakura_max_slope
: Maximum slope for Itakura parallelogram (default:None
).descriptor
: Descriptor function (default:identity
).reach
: Reach parameter (default:5
).g
: Parameter for derivative DTW (default:0.05
).epsilon
: Epsilon parameter for soft-DTW (default:1.0
).g_arr
: G array for derivative DTW (default:None
).nu
: Regularization parameter for shape-based DTW (default:0.001
).lmbda
: Regularization parameter for penalized DTW (default:1.0
).independent
: Whether to use independent feature DTW (default:True
).c
: Regularization parameter for elastic shape DTW (default:1.0
).warp_penalty
: Penalty for warping path length (default:1.0
).standardize
: Whether to standardize the time series before DTW (default:True
).
Citation
If you use this code in your research, please cite this repository:
@misc{ismail-fawaz2024elastic-vis,
author = {Ismail-Fawaz, Ali and Devanne, Maxime and Berretti, Stefano and Weber, Jonathan and Forestier, Germain},
title = {Elastic Warping Visualization For Time Series},
year = {2024},
publisher = {Github},
journal = {GitHub repository},
howpublished = {\url{https://github.com/yourusername/dtw-visualization}}
}
Acknowledgments
We would like to thank the authors of the UCR, UEA and Monash archives for making the Time Series Classification/Regression datasets publicly available. We would also like to thank the Aeon time series machine learning python toolkit for their fast implementation of elastic similarity measures.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file elastic_warping_vis-0.2.0.tar.gz
.
File metadata
- Download URL: elastic_warping_vis-0.2.0.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b82cbc6a2bc3a608f65352ecf32ebbef19f52a469ca9a36d439512638b86b9a8 |
|
MD5 | a8bf245bc93ab86c8ca824dc464eeb73 |
|
BLAKE2b-256 | de407d5a832fe4a2f3d73ebfd6a3b02174dfc135b849c88b2a642f9e56785a53 |
File details
Details for the file elastic_warping_vis-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: elastic_warping_vis-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0909d6ac29e4044dc82d5105f3958927f869325b14e8b7ff95ad5906ce468895 |
|
MD5 | 1b5fd746addf2cd6a17b7a5c7151432c |
|
BLAKE2b-256 | ee9cb2d8b2bd290bf33af2ccdd512047657ccbd2b60087909e70cf6843c97b8c |