Question

I currently have arrays that look something like this:

[  5.23324730e-03   1.01221129e-04   5.23324730e-03 ...,]

There are 500 such rows and 64 columns. I would like to compare a row like the one above, to other rows in a similar format. That is, I want to compare the 1st element in one array to the first element in the second array and so on.

The idea is to work out how closely they match... Would anyone have any ideas how I might go about this efficiently? I should note that values may not be identical.... But if I could find values that differ by amounts under a certain threshold, that would be fine.

If anyone is wondering - I'm trying to compare SURF descriptors...

Thanks so much for your help!

Was it helpful?

Solution

You can save it as a numpy matrix and then calculate the cosine similarity of each row. This can be done efficiently using the numpy dot product product method

OTHER TIPS

The question depends on your definition of closely match. One common way would be calculate euclidean distance.

How can the euclidean distance be calculated with numpy? or

Distance between numpy arrays, columnwise

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top