Surprise icon indicating copy to clipboard operation
Surprise copied to clipboard

Is there a way to add custom similarity metrics?

Open agb2k opened this issue 3 years ago • 1 comments

I was planning on implementing a k-Furthest Neighbours algorithm which is the inverse of the existing kNN but with an inverse similarity metric. How would I implement this? Is there a way to add custom metrics?

agb2k avatar Apr 21 '22 05:04 agb2k

Hi @agb2k, the entry-point for similarity metrics is this function

https://github.com/NicolasHug/Surprise/blob/3414ad931c1ef4630fdaf2a0ca6b8cd3cd1cbc1b/surprise/prediction_algorithms/algo_base.py#L205

Take a look at the internals. You might want to implement your function in Cython to speed it up.

NicolasHug avatar Aug 14 '22 19:08 NicolasHug