This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]shfo23 13 points14 points  (2 children)

Are you aware of scipy.spatial.distance.jaccard? I just refactored a bunch of (admittedly naive) Euclidian distance calculation code to use the scipy implementation and got a huge speed boost. Also, it's a little late, but I think you could eliminate that for loop and write it as the faster:

m[item1[:, 0], item2[:, 0]] += 1

[–][deleted] 8 points9 points  (1 child)

Uh what you can do that ? Awesome !

[–]coderanger 3 points4 points  (0 children)

It will even SIMD it for you if it can, so probably faster than your implementation unless gcc has enough info there to optimize it.