Skip to contents

SOURCE. Liang, D., Krishnan, R.G., Hoffman, M.D. and Jebara, T. (2018), "Variational Autoencoders for Collaborative Filtering", Proceedings of the 2018 World Wide Web Conference (WWW '18), pp. 689-698, doi:10.1145/3178876.3186150.

Usage

Vaecf(
  R,
  K = 5,
  latent_dim = 2,
  beta = 0.2,
  n_samples = 16,
  relevance = NULL,
  w_scale = 1,
  skip = 0
)

Arguments

R

n_users-by-n_items non-negative click matrix.

K

Ranking cut-off in 1..n_items.

latent_dim

Latent width.

beta

KL annealing weight.

n_samples

Reparameterised draws per user.

relevance

Binary held-out relevance, or NULL for R > 0.

w_scale

Scales the decoder weights; 0 makes pi uniform.

skip

Offset into the shared deterministic stream.

Value

List with elbo, loglik, kl, elbo_per_user, loglik_per_user, kl_per_user, recall, ndcg, recall_per_user, ndcg_per_user, ranking, mu, logvar, n_users, n_items, k.

Details

The contribution is the MULTINOMIAL likelihood in place of the Gaussian or logistic one (Section 2.2): pi(z_u) = softmax(f(z_u)) and log p(x_u|z_u) = sum_i x_ui log pi_i(z_u), which spends a fixed probability budget on the items the model believes will be clicked. The objective is the beta-annealed bound of Eq. (5), L_beta = E_q[log p(x_u|z)] - beta KL(q(z|x_u) || p(z)), with beta < 1 the partial regularisation of Section 2.2.2.

The encoder input is the L2-normalised log(1 + x_u) transform of Section 2.2, not the raw counts.

RANKING. Recall@K and truncated NDCG@K are the Section 4.1 definitions: Recall@K = sum_{r<=K} I[w(r) in I_u] / min(K, |I_u|) and DCG@K = sum_{r<=K} (2^{I[w(r) in I_u]} - 1)/log2(r+1). Ties are broken by ascending item index in both language arms – R scans a matrix column-major and Python row-major, so an unpinned tie rule is a real parity hazard.

DETERMINISM. Untrained weights and the reparameterisation noise come from the shared deterministic normal stream. Relevance defaults to the input clicks, making the metrics in-sample; pass relevance for a held-out set.

References

Liang, D., Krishnan, R.G., Hoffman, M.D. and Jebara, T. (2018). WWW '18, pp. 689-698. doi:10.1145/3178876.3186150.

Examples

Vaecf(matrix(c(1, 0, 0, 1, 1, 0), 2, 3), K = 2)$ndcg
#> [1] 0.5