Python port of R's Comprehensive Dynamic Time Warp algorithm package

Overview

Welcome to the dtw-python package

Comprehensive implementation of Dynamic Time Warping algorithms.

DTW is a family of algorithms which compute the local stretch or compression to apply to the time axes of two timeseries in order to optimally map one (query) onto the other (reference). DTW outputs the remaining cumulative distance between the two and, if desired, the mapping itself (warping function). DTW is widely used e.g. for classification and clustering tasks in econometrics, chemometrics and general timeseries mining.

This package provides the most complete, freely-available (GPL) implementation of Dynamic Time Warping-type (DTW) algorithms up to date. It is a faithful Python equivalent of R's DTW package on CRAN. Supports arbitrary local (e.g. symmetric, asymmetric, slope-limited) and global (windowing) constraints, fast native code, several plot styles, and more.

Documentation

Please refer to the main DTW suite homepage for the full documentation and background.

The best place to learn how to use the package (and a hopefully a decent deal of background on DTW) is the companion paper Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package, which the Journal of Statistical Software makes available for free. It includes detailed instructions and extensive background on things like multivariate matching, open-end variants for real-time use, interplay between recursion types and length normalization, history, etc.

To have a look at how the dtw package is used in domains ranging from bioinformatics to chemistry to data mining, have a look at the list of citing papers.

Note: R is the prime environment for the DTW suite. Python's docstrings and the API below are generated automatically for the sake of consistency and maintainability, and may not be as pretty.

Features

The implementation provides:

  • arbitrary windowing functions (global constraints), eg. the Sakoe-Chiba band and the Itakura parallelogram;
  • arbitrary transition types (also known as step patterns, slope constraints, local constraints, or DP-recursion rules). This includes dozens of well-known types:
  • partial matches: open-begin, open-end, substring matches
  • proper, pattern-dependent, normalization (exact average distance per step)
  • the Minimum Variance Matching (MVM) algorithm (Latecki et al.)

In addition to computing alignments, the package provides:

  • methods for plotting alignments and warping functions in several classic styles (see plot gallery);
  • graphical representation of step patterns;
  • functions for applying a warping function, either direct or inverse;
  • a fast native (C) core.

Multivariate timeseries can be aligned with arbitrary local distance definitions, leveraging the [proxy::dist](https://www.rdocumentation.org/packages/proxy/versions/0.4-23/topics/dist) (R) or [scipy.spatial.distance.cdist](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html) (Python) functions.

Citation

When using in academic works please cite:

    1. Giorgino. Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package. J. Stat. Soft., 31 (2009) doi:10.18637/jss.v031.i07.

When using partial matching (unconstrained endpoints via the open.begin/open.end options) and/or normalization strategies, please also cite:

    1. Tormene, T. Giorgino, S. Quaglini, M. Stefanelli (2008). Matching Incomplete Time Series with Dynamic Time Warping: An Algorithm and an Application to Post-Stroke Rehabilitation. Artificial Intelligence in Medicine, 45(1), 11-34. doi:10.1016/j.artmed.2008.11.007

Source code

Releases (stable versions) are available in the dtw-python project on PyPi. Development occurs on GitHub at <https://github.com/DynamicTimeWarping/dtw-python>.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Comments
  • Using sakoechiba window is slower than nowindow

    Using sakoechiba window is slower than nowindow

    • Python port of R's Comprehensive Dynamic Time Warp algorithm package version: 1.1.10
    • Python version: Python 3.9.7 (default, Nov 4 2021, 19:19:42)
    • Operating System: macOS Monterrey 12.1

    Description

    Describe what you were trying to get done. I'm trying to correlate two 1-D series with the DTW algorithm and wanted to control the window size used during warping. Applying the sakoechiba window constraint seems to massively slow down the algorithm execution. Is this intended?

    My query and reference curves are of length ~12000.

    Tell us what happened, what went wrong, and what you expected to happen. I expected using windowing would in fact speed up execution rather than slow it down?

    What I Did

    start = time()
    alignment = dtw(
        query,
        reference,
        dist_method="euclidean",
        window_type="sakoechiba",
        window_args={"window_size": 20},
        keep_internals=True,
    )
    duration = time() - start
    print(f"{duration=}")
    
    output: 194.4200530052185
    
    start = time()
    alignment = dtw(
        query,
        reference,
        dist_method="euclidean",
        window_type=None,
        keep_internals=True,
    )
    duration = time() - start
    print(f"{duration=}")
    
    output: 19.95380139350891
    
    opened by vancromy 9
  • import issue of latest version 1.1.7

    import issue of latest version 1.1.7

    • Python port of R's Comprehensive Dynamic Time Warp algorithm package version: 1.1.7
    • Python version: 3.8
    • Operating System: Ubuntu

    Description

    import crashing

    What I Did

    > import dtw
    
    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    <ipython-input-4-516d6c3d3d57> in <module>
    ----> 1 import dtw
    
    /usr/local/lib/python3.8/dist-packages/dtw/__init__.py in <module>
         15 
         16 # List of things to export on "from dtw import *"
    ---> 17 from dtw.dtw import *
         18 from dtw.stepPattern import *
         19 from dtw.countPaths import *
    
    /usr/local/lib/python3.8/dist-packages/dtw/dtw.py in <module>
         34 from dtw.stepPattern import *
         35 from dtw._backtrack import _backtrack
    ---> 36 from dtw._globalCostMatrix import _globalCostMatrix
         37 from dtw.window import *
         38 from dtw.dtwPlot import *
    
    /usr/local/lib/python3.8/dist-packages/dtw/_globalCostMatrix.py in <module>
          1 import numpy
          2 from dtw.window import noWindow
    ----> 3 from dtw._dtw_utils import _computeCM_wrapper
          4 
          5 
    
    /usr/local/lib/python3.8/dist-packages/dtw/_dtw_utils.pyx in init dtw._dtw_utils()
    
    ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
    
    
    opened by RidwanAlam 6
  • Consider warning on import, rather than printing citation info to stdout

    Consider warning on import, rather than printing citation info to stdout

    Hello, thanks for this excellent package. In the current version, running

    import dtw
    

    Leads to the following being placed in standard output

      Importing the dtw module. When using in academic works please cite:
        T. Giorgino. Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package.
        J. Stat. Soft., doi:10.18637/jss.v031.i07.
    

    I absolutely agree with the need to prompt users to cite sources, but printing this to standard output is somewhat unconventional compared to other Python projects based on published works. I am currently running a large benchmarking experiment, and I need to manually suppress this print statement every time I import a model that uses dtw internally.

    Would you consider printing this using warnings.warn? In my opinion, that would be a bit more consistent with how other repos handle this issue. Warnings and exceptions are also a bit easier to manage than stdout. Thank you!

    opened by williamgilpin 4
  • R plot output

    R plot output

    Could not find a R specific repo so apologies for posting here.

    I'm trying to integrate the dtw twoWay plot into a shiny dashboard but unfortunately keep getting API errors/mismatches when using renderPlot to get the output to a window. I assume this is because the dtw plot output is different from base or ggplot outputs and so I was curious if there is any way around this (rather then me trying to reinvent the plotting function into ggplot somehow..)

    opened by rb643 4
  • Why can open_end=True and/or open_begin=True lead to not finding a warping function?

    Why can open_end=True and/or open_begin=True lead to not finding a warping function?

    I noticed that in certain cases, setting open_end=True and/or open_begin=True can lead to not finding a warping function. I found this surprising, as intuitively, I would have expected the removal of one or several constraints (i.e., start and end have to match) to make it easier to find a warping function, not harder.

    I've attached two files for an example time series to reproduce the proplem:

    >>> import numpy as np
    >>> from dtw import *
    
    >>> x = np.loadtxt("x.txt")
    >>> y = np.loadtxt("y.txt")
    
    # works fine
    >>> _ = dtw(x, y, step_pattern="asymmetricP05")
    
    # doesn't work
    >>> _ = dtw(x, y, step_pattern="asymmetricP05", open_end=True)
    ValueError: No warping path found compatible with the local constraints
    

    Is this a bug, or am I missing something in my understanding of DTW?

    x.txt y.txt

    opened by tcwalther 4
  • Using open begin together with rigid step pattern disallows matching on first reference element (Both Python and R)

    Using open begin together with rigid step pattern disallows matching on first reference element (Both Python and R)

    • Python port of R's Comprehensive Dynamic Time Warp algorithm package version: 1.3.1
    • Python version: 3.8.13
    • Operating System: Win64

    Description

    Both in R and Python, the implementation of open begin combined with the implementation of the rigid step pattern prevents alignment on the first element of the reference series. As far as I can tell from the literature, this is an unintended consequence. Other step patterns don't have this problem.

    I'm primarily an R user, so I'll explain where it comes from using the R code, but because it works the same in Python, this holds there as well.

    Adding the initial row of 0 to the distance matrix/cost matrix is done to account for all the other step matrices that look further back (from dtw.R)

    if (open.begin) {
            if (is.na(norm) || norm != "N") {
                stop("Open-begin requires step patterns with 'N' normalization (e.g. asymmetric, or R-J types (c)). See papers in citation().")
            }
            lm <- rbind(0, lm)
            np <- n + 1
            precm <- matrix(NA, nrow = np, ncol = m)
            precm[1, ] <- 0
        }
    

    For query <- c(1, 2, 3, 4); ref <- c(1, 2, 3, 4, 5, 6) the lm following from the above looks like this

    # >     [,1] [,2] [,3] [,4] [,5] [,6]
    # > [1,]    0    0    0    0    0    0
    # > [2,]    0    1    2    3    4    5
    # > [3,]    1    0    1    2    3    4
    # > [4,]    2    1    0    1    2    3
    # > [5,]    3    2    1    0    1    2
    

    Which is then passed to globalCostMatrix() with the rigid step pattern

    # >      [,1] [,2] [,3] [,4]
    # > [1,]    1    1    1   -1
    # > [2,]    1    0    0    1 
    

    And produces this costMatrix and directionMatrix:

    # > $costMatrix
    # >      [,1] [,2] [,3] [,4] [,5] [,6]
    # > [1,]    0    0    0    0    0    0
    # > [2,]   NA    1    2    3    4    5
    # > [3,]   NA   NA    2    4    6    8
    # > [4,]   NA   NA   NA    3    6    9
    # > [5,]   NA   NA   NA   NA    4    8
    
    # > $directionMatrix
    # >      [,1] [,2] [,3] [,4] [,5] [,6]
    # > [1,]   NA   NA   NA   NA   NA   NA
    # > [2,]   NA    1    1    1    1    1
    # > [3,]   NA   NA    1    1    1    1
    # > [4,]   NA   NA   NA    1    1    1
    # > [5,]   NA   NA   NA   NA    1    1
    

    I assume this can be fixed either on the initial distance/cost matrix handling, or on the rigid step pattern implementation. I don't know which is better. For me, since I'm only using the rigid step pattern, I made the following change, but it almost certainly will have unintended consequences with other step patterns:

    if (open.begin) {
            if (is.na(norm) || norm != "N") {
                stop("Open-begin requires step patterns with 'N' normalization (e.g. asymmetric, or R-J types (c)). See papers in citation().")
            }
    #        lm <- rbind(0, lm)
    #        np <- n + 1
            np <- n
    #        precm <- matrix(NA, nrow = np, ncol = m)
            precm <- matrix(NA, nrow = n, ncol = m)
    #        precm[1, ] <- 0
            precm[1, ] <- lm[1, ]
        }
    

    What I Did

    It's easy to see the behavior with the following:

    from dtw import *
    import numpy as np
    query = [1, 2, 3, 4]
    reference = [1, 2, 3, 4, 5, 6]
    alignment = dtw(query, reference, open_end=True, open_begin=True, step_pattern=rigid)
    alignment.index1
    alignment.index2
    
    opened by daniellemccool 3
  • dtwPlotTwoWay function leads to a crash

    dtwPlotTwoWay function leads to a crash

    • Python port of R's Comprehensive Dynamic Time Warp algorithm package version: v1.2.0
    • Python version: 3.9
    • Operating System: Win10

    Description

    Using the dtwPlotTwoWay functions leads to a crash.

    Changing both numpy.nan to 0 in line 166 and 167 in dtwPlot.py seems to solve the crash.

    What I Did

    #Using the dtwPlotTwoWay functions in a py file.
    import numpy as np
    from dtw import *
    
    seq1 = range(5, 9)
    seq2 = range(1, 9)
    
    alignment_1_2 = dtw(seq1, seq2, keep_internals=True, step_pattern = asymmetric, open_end=True, open_begin=True)
    alignment_2_1 = dtw(seq2, seq1, keep_internals=True, step_pattern = asymmetric, open_end=True, open_begin=True)
    
    dtwPlotTwoWay(alignment_1_2, xts=seq1, yts=seq2, offset=1, ts_type='l', match_indices=None, match_col='gray', xlab='Index', ylab='Query value')
    
    
    Traceback (most recent call last):
      File "C:\Users\name\Desktop\P2\DTWtest.py", line 10, in <module>
        dtw(seq1, seq2, keep_internals=True).plot(type="twoway", offset=1)
      File "C:\Users\name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\dtw\dtw.py", line 124, in plot
        return dtwPlot(self, type, **kwargs)
      File "C:\Users\name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\dtw\dtwPlot.py", line 70, in dtwPlot
        return dtwPlotTwoWay(x, **kwargs)
      File "C:\Users\name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\dtw\dtwPlot.py", line 166, in dtwPlotTwoWay
        xts = numpy.pad(xts,(0,maxlen-len(xts)),"constant",constant_values=numpy.nan)
      File "<__array_function__ internals>", line 5, in pad
      File "C:\Users\name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\lib\arraypad.py", line 803, in pad
        _set_pad_area(roi, axis, width_pair, value_pair)
      File "C:\Users\name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\lib\arraypad.py", line 147, in _set_pad_area
        padded[left_slice] = value_pair[0]
    ValueError: cannot convert float NaN to integer
    
    opened by XueYanYu 3
  • Suggestion: Remove the plt.show() calls in the plotting functions

    Suggestion: Remove the plt.show() calls in the plotting functions

    Hey there,

    See title. This would allow the user to actually use the returned ax object, e.g. to plot more things into these Axes. Currently the plt.show() command blocks this.

    The usual pyplot way of things is to make the figure and axes, then plot stuff into it, customize the ticks etc, and then finally call plt.show() or plt.savefig() - as the user's responsibility.

    Also, it would be great to have more parameters, e.g. for figure size

    Cheers

    opened by RaverJay 3
  • Modifed dtwPlotTwoWay to fix issues with small offsets (issue #22)

    Modifed dtwPlotTwoWay to fix issues with small offsets (issue #22)

    A potential fix for small offsets when using a two way plot #22

    Reference time series is now plotted on the same axis as the query. In the event of a non-zero offset, the reference values are adjusted by the offset and an offset twin axis is generated with the same scale of the original axis.

    NOTE: This changes how each time series appears different in scale and should be considered as a design question.

    For some alignments the two-way plot now looks different. Prior to the change, (with non-zero offset) each time series would be plot on its own axis and consequently would result in matplotlib auto-scaling each time series to best fit each axis. Time-series of different averages would then be shown to be of a similar average height. However, now they the time-series are being plot on the same axis, differences in scale become much more apparent and true to the values of the data.

    Depending on the goal of the user/designers, this may or may not be beneficial. For example, if one was to look at two time-series with drastically differing averages and was trying to show common peaks between the two at certain time intervals while ignoring peak height, this could result in the alignment being much harder to see. Alternatively, if peak height was equally important as when peaks were present, then this change would result in a clearer graph. One could argue that pre-processing should be used normalize the data somewhat if the scales were originally different.

    Before change with time series being of similar average heights: dtw scale original

    After change the reference time series has a much larger average. Additionally note the change in scale of the twin y axis: dtw scale fixed

    opened by nicholaslivingstone 3
  • Need help

    Need help

    • Python port of R's Comprehensive Dynamic Time Warp algorithm package version: 1.1.6
    • Python version: 3.7
    • Operating System: Ubuntu 18.04

    Description

    I want to find DTW score between two time series. To understand how these algorithm work I use two libraries, dtw-python and tslearn.

    However, I'm getting different results and I don't know why. Any help would be appreciate :)

    What I Did

    import numpy as np
    import tslearn.metrics as tsm
    import dtw
    
    x = np.linspace(0, 50, 100)
    
    ts1 = pd.Series(3 * np.sin(x / .5))
    ts2 = pd.Series(2 * np.sin(x))
    

    Results

    
    tsm.dtw(ts1, ts2) -> 16.578554103357583
    
    dtw_result = dtw.dtw(x=ts1, y=ts2, dist_method="euclidean", step_pattern="symmetric2") -> 174.2896
    
    

    Why do I have such a big difference? I tried all the available step_pattern functions for dtw-python library but without any success. Which one is correct result?

    opened by Okroshiashvili 3
  • twoway plot results in a gap between alignment lines and time series for small offset values

    twoway plot results in a gap between alignment lines and time series for small offset values

    • Python port of R's Comprehensive Dynamic Time Warp algorithm package version: 1.1.12
    • Python version: 3.9.10
    • Operating System: Windows 10

    Description

    I'm working with timeseries data near zero. When trying to display a twoway plot of the alignment, I need to use small offset values to properly show alignments between the data. Small offset values seem to result in the alignment lines not fully touching the reference timeseries.

    What I Did

    A reproducible example which results in the following graph:

    x = np.linspace(0, 4 * np.pi)
    y = np.sin(x) * 0.001
    y2 = np.sin(x) * 2 * 0.001
    
    alignment = dtw(y, y2, keep_internals=True)
    alignment.plot(type='twoway', offset=-0.005)
    

    alignment offset

    As well as an example from the data I was working with which caused me to notice the issue. The alignment lines become especially skewed between the 600-800 index range.

    alignment offset not reproducible

    Potential Fix

    I think the issue might have something to do with some rounding or scaling in matplotlibs backend having to do with the twin axis. I've been able to more or less mitigate the issue by modifying the dtwPlotTwoWay function to plot both time series on the same axis instead of plotting on the twin axis.

    def adjusted_dtwPlotTwoWay(...):
    ...
    
        ax.plot(times, yts - offset, **kwargs) # Plot on the same axis, adjust the time series by the offset
    
        if offset != 0:
            ql, qh = ax.get_ylim()
            ax2.set_ylim(ql + offset, qh + offset)
    
    ...
    

    Results of the change

    alignment offset fixed

    alignment offset not reproducible fixed

    opened by nicholaslivingstone 2
  • Bump pypa/cibuildwheel from 2.11.3 to 2.11.4

    Bump pypa/cibuildwheel from 2.11.3 to 2.11.4

    Bumps pypa/cibuildwheel from 2.11.3 to 2.11.4.

    Release notes

    Sourced from pypa/cibuildwheel's releases.

    v2.11.4

    • 🐛 Fix a bug that caused missing wheels on Windows when a test was skipped using CIBW_TEST_SKIP (#1377)
    • 🛠 Updates CPython 3.11 to 3.11.1 (#1371)
    • 🛠 Updates PyPy 3.7 to 3.7.10, except on macOS which remains on 7.3.9 due to a bug. (#1371)
    • 📚 Added a reference to abi3audit to the docs (#1347)
    Changelog

    Sourced from pypa/cibuildwheel's changelog.

    v2.11.4

    24 Dec 2022

    • 🐛 Fix a bug that caused missing wheels on Windows when a test was skipped using CIBW_TEST_SKIP (#1377)
    • 🛠 Updates CPython 3.11 to 3.11.1 (#1371)
    • 🛠 Updates PyPy to 7.3.10, except on macOS which remains on 7.3.9 due to a bug on that platform. (#1371)
    • 📚 Added a reference to abi3audit to the docs (#1347)
    Commits
    • 27fc88e Bump version: v2.11.4
    • a7e9ece Merge pull request #1371 from pypa/update-dependencies-pr
    • b9a3ed8 Update cibuildwheel/resources/build-platforms.toml
    • 3dcc2ff fix: not skipping the tests stops the copy (Windows ARM) (#1377)
    • 1c9ec76 Merge pull request #1378 from pypa/henryiii-patch-3
    • 22b433d Merge pull request #1379 from pypa/pre-commit-ci-update-config
    • 98fdf8c [pre-commit.ci] pre-commit autoupdate
    • cefc5a5 Update dependencies
    • e53253d ci: move to ubuntu 20
    • e9ecc65 [pre-commit.ci] pre-commit autoupdate (#1374)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 0
  • Finding multiple matches

    Finding multiple matches

    I'm trying to find the closest matches to a query graph of length 100 in a much longer time series of 100000 length. I'd like it to return all matches with a normalizedDistance < X. How would I do this?

    This is what I have so far:

    from dtw import *
    import numpy as np
    import matplotlib.pyplot as plt
    
    data = np.cumsum(np.random.uniform(-0.5, 0.5, 1000000))
    query = np.cumsum(np.random.uniform(-0.5, 0.5, 100))
    
    alignment = dtw(query, data, window_type='sakoechiba', window_args={'window_size': 10}, step_pattern="asymmetricP05", open_begin=True, open_end=True)
    
    print(alignment.normalizedDistance) # 0.8975468634096962
    

    It works but it only returns a single result. How do I return all matches with a normalizedDistance < X?

    opened by tommedema 1
  • Warped series is not of the same length as the reference and query

    Warped series is not of the same length as the reference and query

    • Python port of R's Comprehensive Dynamic Time Warp algorithm package version:
    • Python version: 3.7.3
    • Operating System: OS X

    Description

    If the query and reference series are of size N, then the warped series is always of size N-1. This can be explained by how the warp function is set up:

    jset = alignment.index2 jmax = numpy.max(jset) ii = function(numpy.arange(jmax)) return ii

    As Python starts counting from 0, jmax is always N-1. I was wondering whether this is the desired output or whether the length of the warped series should also be N.

    What I Did

    alignment = dtw(
    +        y_pred,
    +        y_true,
    +        keep_internals=True,
    +        step_pattern=step_pattern,
    +        window_type="sakoechiba",
    +        window_args={"window_size": 4},
    +    )
    +    warped_indices = warp(alignment, index_reference=False)
    +    aligned_series = y_pred[warped_indices]
    
    opened by JulietteVTrigt 8
Releases(v1.3.0)
Owner
Dynamic Time Warping algorithms
The comprehensive Dynamic Time Warping library
Dynamic Time Warping algorithms
An e-commerce company wants to segment its customers and determine marketing strategies according to these segments.

customer_segmentation_with_rfm Business Problem : An e-commerce company wants to

Buse Yıldırım 3 Jan 06, 2022
The code used for the free [email protected] Webinar series on Reinforcement Learning in Finance

Reinforcement Learning in Finance [email protected] Webinar This repository provides the code f

Yves Hilpisch 62 Dec 22, 2022
Ensemble Visual-Inertial Odometry (EnVIO)

Ensemble Visual-Inertial Odometry (EnVIO) Authors : Jae Hyung Jung, Yeongkwon Choe, and Chan Gook Park 1. Overview This is a ROS package of Ensemble V

Jae Hyung Jung 95 Jan 03, 2023
Official PyTorch implementation for paper "Efficient Two-Stage Detection of Human–Object Interactions with a Novel Unary–Pairwise Transformer"

UPT: Unary–Pairwise Transformers This repository contains the official PyTorch implementation for the paper Frederic Z. Zhang, Dylan Campbell and Step

Frederic Zhang 109 Dec 20, 2022
Sub-tomogram-Detection - Deep learning based model for Cyro ET Sub-tomogram-Detection

Deep learning based model for Cyro ET Sub-tomogram-Detection High degree of stru

Siddhant Kumar 2 Feb 04, 2022
Python wrappers to the C++ library SymEngine, a fast C++ symbolic manipulation library.

SymEngine Python Wrappers Python wrappers to the C++ library SymEngine, a fast C++ symbolic manipulation library. Installation Pip See License section

136 Dec 28, 2022
PyTorch source code for Distilling Knowledge by Mimicking Features

LSHFM.detection This is the PyTorch source code for Distilling Knowledge by Mimicking Features. And this project contains code for object detection wi

Guo-Hua Wang 4 Dec 17, 2022
HAT: Hierarchical Aggregation Transformers for Person Re-identification

HAT: Hierarchical Aggregation Transformers for Person Re-identification

11 Sep 05, 2022
Pytorch implementation of Each Part Matters: Local Patterns Facilitate Cross-view Geo-localization https://arxiv.org/abs/2008.11646

[TCSVT] Each Part Matters: Local Patterns Facilitate Cross-view Geo-localization LPN [Paper] NEWs Prerequisites Python 3.6 GPU Memory = 8G Numpy 1.

46 Dec 14, 2022
Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021)

Transferable Semantic Augmentation for Domain Adaptation Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021) Paper

66 Dec 16, 2022
Compressed Video Action Recognition

Compressed Video Action Recognition Chao-Yuan Wu, Manzil Zaheer, Hexiang Hu, R. Manmatha, Alexander J. Smola, Philipp Krähenbühl. In CVPR, 2018. [Proj

Chao-Yuan Wu 479 Dec 26, 2022
Medical Insurance Cost Prediction using Machine earning

Medical-Insurance-Cost-Prediction-using-Machine-learning - Here in this project, I will use regression analysis to predict medical insurance cost for people in different regions, and based on several

1 Dec 27, 2021
A 3D sparse LBM solver implemented using Taichi

taichi_LBM3D Background Taichi_LBM3D is a 3D lattice Boltzmann solver with Multi-Relaxation-Time collision scheme and sparse storage structure impleme

Jianhui Yang 121 Jan 06, 2023
StarGAN2 for practice

StarGAN2 for practice This version of StarGAN2 (coined as 'Post-modern Style Transfer') is intended mostly for fellow artists, who rarely look at scie

vadim epstein 87 Sep 24, 2022
YOLOv5 Series Multi-backbone, Pruning and quantization Compression Tool Box.

YOLOv5-Compression Update News Requirements 环境安装 pip install -r requirements.txt Evaluation metric Visdrone Model mAP ZhangYuan 719 Jan 02, 2023

WRENCH: Weak supeRvision bENCHmark

🔧 What is it? Wrench is a benchmark platform containing diverse weak supervision tasks. It also provides a common and easy framework for development

Jieyu Zhang 176 Dec 28, 2022
Demonstrational Session git repo for H SAF User Workshop (28/1)

5th H SAF User Workshop The 5th H SAF User Workshop supported by EUMeTrain will be held in online in January 24-28 2022. This repository contains inst

H SAF 4 Aug 04, 2022
A modification of Daniel Russell's notebook merged with Katherine Crowson's hq-skip-net changes

Edits made to this repo by Katherine Crowson I have added several features to this repository for use in creating higher quality generative art (featu

Paul Fishwick 10 May 07, 2022
Object Depth via Motion and Detection Dataset

ODMD Dataset ODMD is the first dataset for learning Object Depth via Motion and Detection. ODMD training data are configurable and extensible, with ea

Brent Griffin 172 Dec 21, 2022
571 Dec 25, 2022