Fix benchmarks/models/itemknn/README.md (#2)
Browse files- Fix benchmarks/models/itemknn/README.md (d69892ed73a8743612039b1b033302db1a8b18f5)
Co-authored-by: Vladimir <[email protected]>
benchmarks/models/itemknn/README.md
CHANGED
@@ -1,21 +1,30 @@
|
|
1 |
-
|
2 |
|
3 |
-
We employ cosine similarity to measure
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
|
13 |
-
|
14 |
|
|
|
15 |
|
|
|
|
|
|
|
16 |
|
17 |
|
|
|
18 |
|
19 |
|
|
|
20 |
|
|
|
|
|
|
|
21 |
|
|
|
1 |
+
# ItemKNN
|
2 |
|
3 |
+
We employ cosine similarity to measure similarity between vectors. Item vectors are represented as num_users-dimensional vectors derived from the user-item interaction matrix.
|
4 |
|
5 |
+
Top-k recommendations are generated by retrieving vectors closest to the user's temporal interaction pattern (with decay parameter \\(\tau \rightarrow 0\\)) controlling historical influence).
|
6 |
|
7 |
+
The formulation is: \\(score(user_i, item_j) = \cos(V[i, :], U[:,j])\\),
|
8 |
|
9 |
+
where:
|
10 |
|
11 |
+
- \\(U\\) [num user \\(\times\\) num items]: original user-item interaction matrix
|
12 |
|
13 |
+
- \\(V\\) [num users \\(\times\\) num users]: user embedding matrix, where each row is:
|
14 |
|
15 |
+
\\(V[i, :] = \sum_{(t, k) \in A_i} \tau^{\max_t(i) - t} U[:, k]^T\\)
|
16 |
|
17 |
+
- \\(A_i\\): set of \\(i\\)-th user's (interaction timestamp, item index) pairs
|
18 |
+
- \\(\max_t(i)\\): last \\(i\\)-th user's interaction timestamp
|
19 |
+
- \\(\tau\\): time decay coefficient (per second)
|
20 |
|
21 |
|
22 |
+
The hyperparameter `hour` defines the time period (in hours) associated with a decay factor of 0.9.
|
23 |
|
24 |
|
25 |
+
## Memory Optimization
|
26 |
|
27 |
+
For 5b datasets, the matrix multiplications between [num users \\(\times\\) num item] and [num item \\(\times\\) num items] exceeds memory constraints.
|
28 |
+
|
29 |
+
To solve this, we leverage cosine similarity to the mean embedding instead of pairwise similarities to avoid new dimension (x basket_size).
|
30 |
|