lmaraite / Collaborative_Filtering

Collaborative Filtering Implementation
GNU General Public License v3.0
0 stars 0 forks source link

User-Based Evaluation Dataset #29

Closed cvonder1 closed 4 years ago

cvonder1 commented 4 years ago

When doing a user-based evaluation, the matrices in the data set must be transposed. In this part the indices get switched, but the matrices remain erroneously the same.

cvonder1 commented 4 years ago

@lmaraite @Codor77 When thinking about using the prediction functions for user-based, it is kinda obvious, that you need to transpose the matrices, but, when you don't, it is not. What do you think of making the dataset class a little bit more expressive? I thought of using a builder pattern for the dataset. You could then write something as:

data = DatasetBuilder()
  .with_ratings_matrix(ratings_matrix, user_axis=1)
  .with_is_rated_matrix(is_rated_matrix, user_axis=1)
  .with_similarity_matrix(similarity_matrix)
  .with_approach(similarity.USER_BASED).build()

This would not break any existing code, since the dataset constructor is not touched and there is no difficulty with optional parameters in the constructor.