Skip to content

Commit

Permalink
fix IVF user neighbor searching (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz authored Feb 1, 2022
1 parent 47f0309 commit c896921
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions master/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,10 @@ func (m *Master) findUserNeighborsIVF(dataset *ranking.DataSet, labelIDF, itemID
}
itemScores := make([]cache.Scored, len(neighbors))
for i := range scores {
itemScores[i].Id = dataset.ItemIndex.ToName(neighbors[i])
itemScores[i].Id = dataset.UserIndex.ToName(neighbors[i])
itemScores[i].Score = -scores[i]
}
if err := m.CacheClient.SetSorted(cache.Key(cache.UserNeighbors, dataset.ItemIndex.ToName(int32(userId))), itemScores); err != nil {
if err := m.CacheClient.SetSorted(cache.Key(cache.UserNeighbors, dataset.UserIndex.ToName(int32(userId))), itemScores); err != nil {
return errors.Trace(err)
}
if err := m.CacheClient.SetTime(cache.LastUpdateUserNeighborsTime, dataset.UserIndex.ToName(int32(userId)), time.Now()); err != nil {
Expand Down
1 change: 0 additions & 1 deletion storage/cache/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (

// UserNeighbors is sorted set of neighbors for each user.
// Global user neighbors - user_neighbors/{user_id}
// Categorized user neighbors - user_neighbors/{user_id}/{category}
UserNeighbors = "user_neighbors"

CollaborativeRecommend = "collaborative_recommend" // collaborative filtering recommendation for each user
Expand Down

0 comments on commit c896921

Please sign in to comment.