Code Monkey home page Code Monkey logo

Comments (5)

wannesm avatar wannesm commented on June 1, 2024

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.

from dtaidistance.

rabihiawaludin avatar rabihiawaludin commented on June 1, 2024

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

from dtaidistance.

wannesm avatar wannesm commented on June 1, 2024

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)

from dtaidistance.

rabihiawaludin avatar rabihiawaludin commented on June 1, 2024

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

from dtaidistance.

wannesm avatar wannesm commented on June 1, 2024

This is now documented here: https://dtaidistance.readthedocs.io/en/latest/usage/similarity.html

from dtaidistance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.