Closed KarazhovAndrii closed 2 months ago
We would need to support this also in the C code to be consistent. While not necessarily difficult to add in one location, it requires changes at multiple locations (e.g. also in the bounds) and increases the cost of maintaining. So we will have to think about how to do this consistent throughout the codebase (we already have this a bit to support ndim series).
If you urgently need this. It is not too difficult to change this in the python part (no compilation required). Simply change these two lines in the code: https://github.com/wannesm/dtaidistance/blob/054e97ed96a1a14f2981d5e76e957148796567a7/dtaidistance/dtw.py#L289 https://github.com/wannesm/dtaidistance/blob/054e97ed96a1a14f2981d5e76e957148796567a7/dtaidistance/dtw.py#L409
In the master branch, this functionality is now available by using the inner_dist
argument. When using the pure Python implementation, this can be any callable function (wrapped in an object that has as callable arguments inner_dist
and result
). When using the the fast dtw computation in C this needs to be one of 'euclidean' or 'squared euclidean'.
@wannesm , thank you for the updated API - it works. Closing the issue.
Hello DTAI Team,
thank you for sharing this great project. Consider in subsequent releases a possibility for users to define cost function, as they could need different metrics to evaluate the distance when computing DTW. Example of the interface (_distfunc optional parameter is added):
where _distfunc suppose to have a signature: