ctralie / linmdtw

A linear memory, parallelizable algorithm for Dynamic Time Warping (DTW). Also contains cython implementations of FastDTW, and Memory-Restricted Multiscale DTW (MrMsDTW), and globally constrained DTW with the Sakoe-Chiba band (so-called "cdtw")
Apache License 2.0
56 stars 7 forks source link

32 Bit constraint for input vectors #8

Open lvlanson opened 3 years ago

lvlanson commented 3 years ago

Hello Mr Tralie,

this is Thomas Davies. I was wondering why you have this constraint for the input vectors X and Y to be 32 Bit. Do you think it is also possible in the future to work with 64 Bit floats?

Kind Regards, Thomas Davies

ctralie commented 3 years ago

Hi, thanks for your interest in this library! Currently I'm only supporting 32-bit to be consistent with the GPU enabled code, and I've seen in experiments that it doesn't make too much of a difference (see figure 4 here http://www.ctralie.com/Research/linmdtw/paper.pdf) But if you find a use case where that actually makes a difference, I would be very interested to see it!

On Tue, Sep 7, 2021 at 2:10 PM lvlanson @.***> wrote:

Hello Mr Trailie,

this is Thomas Davies. I was wondering why you have this constraint for the input vectors X and Y to be 32 Bit. Do you think it is also possible in the future to work with 64 Bit floats?

Kind Regards, Thomas Davies

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ctralie/linmdtw/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZX5QJIJGX76ZYNI6J3UAZISRANCNFSM5DS5MYQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lvlanson commented 3 years ago

Hi!

I use your DTW algorithm for a machine learning algorithm, where I update the timeseries based on the distance between two timeseries. Over the course of the learning process the float values can become really small, since I need to scale them between 0 and 1 before I start training them. The more epochs I use, the more likely it is that I work with really small floats EDIT: and huge floats. I usually get a buffer overflow warning pretty fast when using linear memory dtw.

There is currently no rush for implementing a 64 bit version. I'd even try to help out myself. Currently I need to finish my thesis and when I'm done I can try to make a 64 bit version. My work is based on this paper https://www.sciencedirect.com/science/article/abs/pii/S0031320317304387. I am incorporating your work as well.

I can send you some code if you are interested in this topic.

ctralie commented 3 years ago

Ah very interesting! So incorporating 64 bit into cython for the CPU version would be no problem; one would just change floats to doubles. However, I'm not aware of how to support 64-bit in pycuda. So I'd have to look into that first

On Wed, Sep 8, 2021 at 2:23 AM lvlanson @.***> wrote:

Hi!

I use your DTW algorithm for a machine learning algorithm, where I update the timeseries based on the distance between two timeseries. Over the course of the learning process the float values can become really small, since I need to scale them between 0 and 1 before I start training them. The more epochs I use, the more likely it is that I work with really small floats. I usually get a buffer overflow warning pretty fast when using linear memory dtw.

There is currently no rush for implementing a 64 bit version. I'd even try to help out myself. Currently I need to finish my thesis and when I'm done I can try to make a 64 bit version. My work is based on this paper https://www.sciencedirect.com/science/article/abs/pii/S0031320317304387. I am incorporating your work as well.

I can send you some code if you are interested in this topic.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ctralie/linmdtw/issues/8#issuecomment-914953853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZSJCNLHAIIIC7TQEXTUA36PRANCNFSM5DS5MYQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ctralie commented 3 years ago

Anyway, if memory is all you care about and you don't need to use CUDA to parallelize the computation, then one thing I could do in the meantime is enable a 64-bit option for the CPU

lvlanson commented 3 years ago

Hey there,

don't worry about this for now. We could add 64-bit support in the future.

For now I need to install the changed linmdtw version in my system. Currently I am having a hard time it being recognized correctly and running.

ctralie commented 3 years ago

Yeah, I'm still reviewing your changes and brushing up on what I did before. If you're using conda, you can setup a new environment with your code https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html and then you can do

pip install -e .

from within your directory. That will install the package with a symbolic link to your code, so anything you change in your code will be updated in what you run. I'd suggest doing that in the meantime before I make a full official release. But the test cases you left are very helpful. I just have limited time because of teaching and other projects, but I will see what I can do today

On Sun, Sep 19, 2021 at 9:18 AM lvlanson @.***> wrote:

Hey there,

don't worry about this for now. We could add 64-bit support in the future.

For now I need to install the changed linmdtw version in my system. Currently I am having a hard time it being recognized correctly and running.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ctralie/linmdtw/issues/8#issuecomment-922472541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZRQFU3SJ5KKXRENB4LUCXPLLANCNFSM5DS5MYQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.