mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-28 23:48:31 +02:00
Update collaborative-filtering.md
Add extra output to show `ratings_agg_df` values.
This commit is contained in:
@@ -99,8 +99,18 @@ merged_df = ratings_df.merge(movies_df[['movieId', 'title']], left_on='movieId',
|
||||
|
||||
# Aggregate ratings to handle duplicate (userId, title) pairs
|
||||
ratings_agg_df = merged_df.groupby(['userId', 'movieId']).rating.mean().reset_index()
|
||||
|
||||
ratings_agg_df.head()
|
||||
```
|
||||
|
||||
| |userId |movieId |rating|
|
||||
|---|---|---|---|
|
||||
|0 |1 |1 |0.429960|
|
||||
|1 |1 |1036 |1.369846|
|
||||
|2 |1 |1049 |-0.509926|
|
||||
|3 |1 |1066 |0.429960|
|
||||
|4 |1 |110 |0.429960|
|
||||
|
||||
### Convert to sparse
|
||||
|
||||
If you want to search across numerous reviews from different users, you can represent these reviews in a sparse matrix.
|
||||
|
||||
Reference in New Issue
Block a user