Closed rabihiawaludin closed 1 year ago
Can you be more precise (or provide a reference or example)? I am not aware of a method that translates a distance to a percentage in general.
for example i have array like this
s1 = [0, 0, 1, 2, 1, 0, 1, 0, 0] s2 = [0, 0, 1, 2, 1, 0, 1, 0, 0]
the distance should be 0.0
if the distance is 0.0, this means that matrix 1 and matrix 2 have the same value, then the similarity of the two matrices is 100%
now, if i change array to
s1 = [0, 0, 1, 2, 1, 0, 1, 0, 0] s2 = [0, 0, 1, 2, 1, 0, 1, 2, 0]
the distance change to 1.0
in this case the similarity of the two matrces percentage must also change, must be less than 100%
@wannesm
What you need is indeed 'similarity' instead of 'distance', which is in the range [0,1]. Multiple transformations exist, of which the two most popular ones seem to be sim = exp(-dist / r)
and sim = 1/(r + dist)
, with r a parameter to control the sensitivity (or avoiding dividing by 0). With numpy you can apply this directly to a distance matrix or arrays of distance values, thus:
distance_matrix = dtw.distance_matrix(series)
similarity_matrix = np.exp(-distance_matrix / r)
can you give me an example? especially for similatiry_matrix.
actually i use this dwt to calculate the similarity of 2 matrix, from feature exttraction (mfcc) @wannesm
This is now documented here: https://dtaidistance.readthedocs.io/en/latest/usage/similarity.html
Hi, can dtw distance show as percentage?