NicolasHug / Surprise

A Python scikit for building and analyzing recommender systems
http://surpriselib.com
BSD 3-Clause "New" or "Revised" License
6.34k stars 1.01k forks source link

How to find the compute_similarities() of neighbours in KNNMean() Algorithm #404

Open KhizarSultan opened 2 years ago

KhizarSultan commented 2 years ago

Description

I have implemented the KNNMean() algorithm for product recommendations. It is working fine and for the evaluation of the model, I have extracted the neighbors of each customer using algo.get_neighbors(toy_story_inner_id, k=10) function but I want to know the similarity score of each neighbor, how can I find the similarity score of the neighbors?

Versions

image

NicolasHug commented 2 years ago

It's not supported but you can just copy paste the code of the get_neighbors method and return the others list right after this line:

https://github.com/NicolasHug/Surprise/blob/46b9914995e6c8c7d227b46f2eaeef2d4600580f/surprise/prediction_algorithms/algo_base.py#L285