caserec / CaseRecommender

Case Recommender: A Flexible and Extensible Python Framework for Recommender Systems
MIT License
471 stars 91 forks source link

For neighborhood recommenders (ItemKNN and UserKNN) change the similarity calculation #5

Closed arthurfortes closed 6 years ago

arthurfortes commented 6 years ago

For both approaches (rating prediction and item recommendation) change the value 1 for the maximum value in the distance matrix.

|Bug info: For measures that don't have the range (0-1) the values after transformation will be wrong.

mayukh18 commented 6 years ago

@ArthurFortes I am taking this up.

arthurfortes commented 6 years ago

You can use something like:

self.su_matrix = self.su_matrix.max() - self.su_matrix

mayukh18 commented 6 years ago

Considering this is similarity, I think it will better to keep it in 0-1 range, thus divide the result by max like self.su_matrix = (self.su_matrix.max() - self.su_matrix)/self.su_matrix.max(). What's your take on this?

arthurfortes commented 6 years ago

It is an interesting and valid observation. If implemented, leave a comment in the code to make users aware. =)

arthurfortes commented 6 years ago

Thx for the contribution. =)

arthurfortes commented 6 years ago

Now, only item recommendation is missing =)

mayukh18 commented 6 years ago

Oh I thought it was only in rating prediction like you said. I'll send in another PR.