Skip to content

Conversation

@Eldar7
Copy link

@Eldar7 Eldar7 commented Feb 12, 2018

Due to recent request https://groups.google.com/forum/#!topic/annoy-user/FheMHkmgjpk chamming distance was added to available distances.

Chamming is a correct hamming distance:
chamming([a,b,c,d],[a,c,b,d]) = 2

@Eldar7
Copy link
Author

Eldar7 commented Feb 12, 2018

ouch, it worked fine with f29296c commit.

@erikbern
Copy link
Collaborator

What's Chamming distance? Can you send a link to an explanation?

@Eldar7
Copy link
Author

Eldar7 commented Feb 12, 2018

It is regular hamming distance https://en.m.wikipedia.org/wiki/Hamming_distance that can be applied to any vectors, not only to binary vectors.

Due to wiki:
The Hamming distance between:
"karolin" and "kathrin" is 3.

@erikbern
Copy link
Collaborator

Can you get this one to pass the tests?

@lbertolotti
Copy link

# -*- coding: utf-8 -*-
"""
Spyder Editor
"""
import annoy
import inspect

u = annoy.AnnoyIndex(5,metric='hamming')
u.add_item(0,'12346')
u.add_item(1,'12345')
u.build(1)
u.save('tree')
u.get_n_items()

In:u.get_distance(0,1)
Out: 0.0
@Eldar7
Copy link
Author

Eldar7 commented May 21, 2018

@erikbern , ok, I'll try to make this one to pass the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants