Skip to content
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

Personalization metric calculation optimization #35

Closed
ibuda opened this issue Oct 26, 2021 · 1 comment
Closed

Personalization metric calculation optimization #35

ibuda opened this issue Oct 26, 2021 · 1 comment

Comments

@ibuda
Copy link
Contributor

ibuda commented Oct 26, 2021

Hi @statisticianinstilettos,

kudos for a great tool!
I would like to propose an optimization for calculating Personalization Metric here:

#get indicies for upper right triangle w/o diagonal
upper_right = np.triu_indices(similarity.shape[0], k=1)

#calculate average similarity
personalization = np.mean(similarity[upper_right])
return 1-personalization

There is no need to get the upper triangle indices, as the cosine similarity is a symmetric distance.
I will follow up with a pull request for this.

@statisticianinstilettos
Copy link
Owner

great update! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants