Code Monkey home page Code Monkey logo

dtw's Introduction

dtw on Hackage dtw on latest Stackage LTS dtw on Stackage Nightly dtw on Haskell-CI

This module implements dynamic time warping as described on Wikipedia

Additionally 'fastDtw' is implemented as described in the paper: "FastDTW: Toward Accurate Dynamic Time Warping in Linear Time and Space" by Stan Salvador and Philip Chan.

For further information see the documentation of the Data.DTW module.

Example

>>> -- create two sample datasets
>>> let as = [ sin x | x <- [0,0.1..pi] ]
>>> let bs = [ sin (x+0.1) | x <- [0,0.1..pi] ]
>>> -- define a cost function between two datapoints
>>> let dist x y = abs (x-y)
>>> -- define a function that will half the size of a dataset (see below)
>>> let shrink xs = case xs of (a:b:cs) -> (a+b)/2 : shrink cs; a:[] -> [a]; [] -> []
>>> -- calculate the cost with fastDtw and dtwMemo for comparison
>>> cost $ fastDtw dist shrink 2 as bs :: Float
>>> 0.19879311
>>> cost $ dtwMemo (\x y -> abs (x-y)) as bs :: Float
>>> 0.19879311

dtw's People

Contributors

fhaust avatar

Stargazers

Graham Joncas avatar L. Applis avatar Jonathan Shobrook avatar George Giatrakos avatar  avatar Darjan Oblak avatar Mark Mazumder avatar Daniel Kahlenberg avatar  avatar  avatar Aistis Raulinaitis avatar Chris A. avatar  avatar Zbigniew Siciarz avatar Gatlin Johnson avatar Mitch Kim avatar Stephen Diehl avatar Kyle Marek-Spartz avatar

Watchers

James Cloos avatar Mark Mazumder avatar Kyle Marek-Spartz avatar  avatar  avatar  avatar

Forkers

semanticbeeng

dtw's Issues

Approximative test of fastDTW fails sometimes.

Due to the approximative nature of fastDTW it is possible to have the test fail on pathological input data. I tried to make the test sensitive to dataset size and relative error between fastDtw and dtwMemo but to no avail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.