Datasets:

Modalities:
Tabular
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
pandas
License:
ploshkin NonameUntitled commited on
Commit
cdf4865
·
verified ·
1 Parent(s): bc72936

Fix benchmarks/models/itemknn/README.md (#2)

Browse files

- Fix benchmarks/models/itemknn/README.md (d69892ed73a8743612039b1b033302db1a8b18f5)


Co-authored-by: Vladimir <[email protected]>

Files changed (1) hide show
  1. benchmarks/models/itemknn/README.md +16 -7
benchmarks/models/itemknn/README.md CHANGED
@@ -1,21 +1,30 @@
1
- ## ItemKNN
2
 
3
- We employ cosine similarity to measure the similarity between vectors. The item vectors are num_users-dimensional vectors derived from the user-item interaction matrix. In the simplest case, we generate top-k recommendations by retrieving the nearest vectors to the user’s most recent item (which corresponds to a decay parameter $\tau \rightarrow 0$). The more general formulation is as follows:
4
 
5
- $score(user_i, item_j) = cos(V[i, :], U[:,j])$,
6
 
7
- where $U$ is num_user x num_items interaction matrix,
8
 
9
- $V$ is num_users x num_users matrix, $V[i, :] = \sum_{(t, k) \in A_i} \tau^{max_t(i) - t} \cdot U[:, k]^T$, where $A_i$ is set of $i$-th user's (interaction_timestamp, item_index) pairs, $max_t(i)$ is last $i$-th user's interaction timestamp, $\tau$ is the decay coefficient (per second).
10
 
11
- The hyperparameter “hour” defines the time period (in hours) associated with a decay factor of 0.9.
12
 
13
- For 5b datasets, the matrix multiplications [num_users × num_item] and [num_item × num_items] to obtain [num_user x num_user]  matrix of user embeddings exceed memory constraints. We also use cosine similarity to the mean embedding instead of pairwise similarities to avoid new dimension (x basket_size).
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