[ANN] DynamicAxisWarping.jl

I would like to announce DynamicAxisWarping.jl which provides a bunch of algorithms related to Dynamic Time Warping, such as

  • DTW
  • FastDTW
  • SoftDTW (differentiable)
  • Optimized nearest neighbor search
  • Barycenter averaging
  • DTW Clustering
  • Matrix profile using DTW distance
  • Implements the Distances.jl interface

doppler

Being a Julia package, we support arbitrary metrics and arbitrary “spaces”, i.e., as long as you are passing a vector or higher dimensional array of something that your distance can operate on, you’re good to go. Time is always considered to be the last dimension. Here’s an example using DTW on spectrograms.

Out of the UCR suite of optimizations, most are implemented

  • Endpoint lower bound pruning
  • Envelope lower bound pruning
  • DTW early termination
  • Online normalization (also works for 2D input)
  • Sorting of query series

Further, all algorithms operate on arbitrary precision numbers. If you pass them Float32 instead of Float64, they can become up to twice as fast.

Thanks to @ericphanson, we have some benchmarks indicating we’re quite a bit faster than the python package fastdtw.

Early parts of this package came from a fork of the abandoned TimeWarp.jl, which in turn built upon the also abandoned DynamicTimeWarping.jl

Happy distance measuring! :smiley:

18 Likes

Optimized nearest neighbor search

Can you give some info on what this means? After having a look at the wiki page for Dynamic time warping, I don’t immediately see what this could mean.

It essentially means that your searching through one long time series for a much shorter pattern. This is a common operation when you’re doing “detection”, and it can be optimized quite heavily.

2 Likes

Some updates:

In the latest version, we now have

4 Likes

Thank You , Dynamic Time Warping looks great I can’t wait to try it out.

Very interested in running https://github.com/baggepinnen/DynamicAxisWarping.jl/blob/master/examples/frequency_warping2.jl but I seem to have the wrong Julia version 1.04 per precompile errors below , ideally Julia LTS v1.04 or v1.05 could be made to work for compatiblity with other Julia packages, but if that’s not possible which versions greater than x.y.z of Julia work please ?

julia> using DynamicAxisWarping
[ Info: Precompiling DynamicAxisWarping [aaaaaaaa-4a10-5553-b683-e707b00e83ce]
ERROR: LoadError: LoadError: syntax: invalid function name "DTWDistance{M <: DTWMethod, D <: SemiMetric} <: SemiMetric"
Stacktrace:
 [1] include at ./boot.jl:317 [inlined]
	.
	.
 [10] eval at ./boot.jl:319 [inlined]
 [11] eval(::Expr) at ./client.jl:393
 [12] top-level scope at ./none:3
in expression starting at /home/marc/.julia/packages/DynamicAxisWarping/xuab5/src/distance_interface.jl:18
in expression starting at /home/marc/.julia/packages/DynamicAxisWarping/xuab5/src/DynamicAxisWarping.jl:40
ERROR: Failed to precompile DynamicAxisWarping [aaaaaaaa-4a10-5553-b683-e707b00e83ce]

Also thought I should mention this “You can always suggest to package authors that they install CompatHelper.jl.” per this post Can someone help me on how to resolve package conflicts with dev'ed packages? - #4 by dilumaluthge

Oh, it seems that the compat declaration for Julia is wrong :confused: I have really only tested the package on the latest version of Julia, which was 1.4 at the time. I used to try to maintain compat with older Julia versions, but noticed that it took a lot of my bandwidth for little gain and decided to not pursue that anymore.

If you’re interested in distances between spectra, you may also be interested in the examples over at

1 Like