recpack.algorithms.loss_functions.covariance_loss
- recpack.algorithms.loss_functions.covariance_loss(H: torch.nn.modules.sparse.Embedding, W: torch.nn.modules.sparse.Embedding) torch.Tensor
Covariance loss.
Convariance loss as described in Cheng-Kang Hsieh et al., Collaborative Metric Learning. WWW2017 http://www.cs.cornell.edu/~ylongqi/paper/HsiehYCLBE17.pdf
The loss term is used to penalize covariance between embedding dimensions and thus disentangle these embedding dimensions.
It is assumed H and W are embeddings in the same space.
- Parameters
H (nn.Embedding) – Item embedding
W (nn.Embedding) – User Embedding
- Returns
Covariance loss term
- Return type
torch.Tensor