-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a distance method to the Glove class #19
base: master
Are you sure you want to change the base?
Conversation
Looks good at first glance. I'll merge when I have access to a computer.
|
A couple of comments:
|
Sure thing. I'll commit the changes as soon as I can. |
@maciejkula one question. Would you like to have _check_model_fitted to check if a word dictionary has been provided as well? |
Good question. Maybe just leave the checks as you wrote them for the moment and I will have a look later and see if there's a non-awful solution. |
Okay, so I decided to retain the distance function for now, by subtracting from 1 the computed similarity. |
I must say I prefer to have the similarity function, it seems to me to be more consistent with the |
Done :) |
except KeyError: | ||
raise Exception('Word not in dictionary') | ||
|
||
return self._distance(self.word_vectors[word1_idx], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually work? Maybe a leftover from the previous version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owo _distance is not defined in the current version anyway. I tried running the code with the added functions _similarity and similarity but ended up with
AttributeError: 'Glove' object has no attribute '_distance'
We can address the Could you just check my comment above? And then maybe I'll finally merge! |
👍 |
Added a distance method to the Glove class to measure the distance between two arbitrary words.
I needed the functionality for my own project and thought it would be useful for this project as a whole.
Let me know if there are any other changes that may need to be done.