halachkin / cdtw Goto Github PK
View Code? Open in Web Editor NEWDynamic Time Warping in C and Python
Dynamic Time Warping in C and Python
C:\Users\p\Downloads>python test.py
Traceback (most recent call last):
File "test.py", line 280, in
run(s,t)
File "test.py", line 63, in run
s.step.set_type('dp2')
AttributeError: Step instance has no attribute 'set_type'
C:\Users\p\Downloads>python test.py
Traceback (most recent call last):
File "test.py", line 280, in
run(s,t)
File "test.py", line 67, in run
d = dtw(ref,query,s)
File "C:\Users\ap\Downloads\cdtw\src\pydtw.py", line 11, in init
cydtw.init(self, ref, query, settings)
File "cydtw.pyx", line 250, in cydtw.cydtw.init (cydtw.c:4337)
self._dtw(ref, query, settings)
File "cydtw.pyx", line 259, in cydtw.cydtw._dtw (cydtw.c:4588)
c_dtw_settings.dist_type = settings.dist.get_cur_type_code()
TypeError: an integer is required
This is resolved with:
python setup.py build_ext --inplace --compiler=msvc
TEST PASSED
C:\Users\p\Downloads>python test.py
Ran 20 tests. 0 failures.
Hi all,
It seems cdtw doesn't support running DTW with two sequences of feature vectors (e.g. MFCC). I get the following error:
Traceback (most recent call last):
File "./s2f.py", line 161, in <module>
d = U[b] - V
File "./s2f.py", line 88, in __sub__
compute_path = False)).get_dist()
File "/my/path/to/python/python2.7/site-packages/cdtw/pydtw.py", line 12, in __init__
cydtw.__init__(self, ref, query, settings)
File "cdtw/cydtw.pyx", line 251, in cdtw.cydtw.cydtw.__init__ (cdtw/cydtw.c:4379)
File "cdtw/cydtw.pyx", line 279, in cdtw.cydtw.cydtw._dtw (cdtw/cydtw.c:4989)
File "/my/path/to/python/python2.7/site-packages/numpy/core/shape_base.py", line 278, in hstack
return _nx.concatenate(arrs, 0)
ValueError: all the input arrays must have same number of dimensions
The code excerpt generating this error:
return pydtw.dtw(this.stFeatures.T, that.stFeatures.T, pydtw.Settings(step = 'p0sym', #Sakoe-Chiba symmetric step with slope constraint p = 0
window = 'palival', #type of the window
param = 2.0, #window parameter
norm = False, #normalization
dist='euclid',
compute_path = False)).get_dist()
this.stFeatures.T
and that.stFeatures.T
are numpy arrays and have shape (38, 13) and (65, 13) respectively.
Is this feature not supported or did I do something wrong?
Any help is appreciated, thank you!
C:\p\SonicEvents>lib\python\python.exe speedtest.py
Traceback (most recent call last):
File "speedtest.py", line 16, in
s.step.set_type('dp2')
AttributeError: Step instance has no attribute 'set_type'
I wonder if you are interested in creating a package for pypi? That would be great, as it would greatly simplify installation (pip install cdtw) and usage.
Hi,
I have an error when I import pydtw after the installation of cdtw:
from cdtw import pydtw
Return:
ImportError: cannot import name 'cydtw' from 'cdtw.cydtw' (unknown location)
Can anyone help me?
I get this error with the speedtest and here.
(Pdb) dtw([1,2,3],[2,3,4],Settings(dist='manhattan', step = 'dp2', window = 'nowindow', compute_path = True))
*** TypeError: an integer is required
Hi,
I wonder if you could add a license? See also:
https://help.github.com/articles/open-source-licensing/
http://choosealicense.com/
MIT would be great ;)
examples.ipynb :
import pydtw
compared to
Readme.md :
from cdtw import pydtw
Hi!
I don't understand the following behavior (code adapted from examples nb):
import numpy as np
import pydtw
t = np.arange(0,3*np.pi,0.2)
r = np.sin(t)
q = np.cos(1.2*t+1) + np.sin(t)
print(pydtw.dtw(r,q,pydtw.Settings(dist = 'manhattan', step = 'dp2', window = 'nowindow', compute_path = True)).get_dist())
print(pydtw.dtw(r,q,pydtw.Settings(dist = 'manhattan', step = 'dp2', window = 'nowindow', compute_path = False)).get_dist())
Output:
12.37014033416319
11.829838028295049
Why do I get different distance when setting compute_path to True or False? Shouldn't the distances be the same regardless (maybe I'm missing something...)?
Thanks!
Readme.md:
The hyperlink of
"well known step patterns dp1, dp2, dp3"
does not link to the intended PDF.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.