-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using weighted distances seemingly not compatible with dtw_cost #58
Comments
The source lines you point to are probably not correct? Could you provide an example that demonstrates the problem? |
It is probably possible to compute the weighted Euclidean distance by scaling the time series before calling |
Sorry, you are right, I meant on lines 208 and 217 in the source file, where dist() is called. A minimal example that doesn't work could be: d = DTW(dist=WeightedSqEuclidean(w), radius=15) This results for me in a dimension mismatch error. Could you provide a small example explaining the scaling? Does this mean I "apply" the weights to both time series first and then compute the Euclidean distance on it? |
Exactly :) Since the weighted distances is defined like this
you have to multiply the time series by
This works because |
By the way, are you sure weighting in time like you are attempting to do actually makes sense in the presence of time warping? If you are comparing |
Thanks for the example! Without going into too much detail, I was playing around with an idea of a more informative distance measure for parameter inference of a simulation model. In short, I have a simulation output y_star (time series) and observation y (also time series) for which I use DTW to compare both. I also have for each parameter a set of weights w that represent the influence this parameter has over time (also time series with same points of observation as y and y_star). My idea was to have a distance measure that takes into account the influential time points for this parameter. However, what you said here:
made me realize that indeed my idea might not make sense in the presence of warping as observation points may get switched around. |
You could potentially incorporate the |
Thanks for all the help! |
Using a weighted metric (e.g. WeightedSqEuclidean) for the dynamic time warping seems to not be possible as the weights passed to the distance are a vector, but in lines 190 and 199 in dtw.jl the cost is calculated using distances between scalar values (but in a for loop over the sequence). This results in a dimension mismatch error when trying to calculate the distance.
The text was updated successfully, but these errors were encountered: