hopwise.model.general_recommender.multivae

Reference:

Dawen Liang et al. “Variational Autoencoders for Collaborative Filtering.” in WWW 2018.

Classes

MultiVAE

MultiVAE is an item-based collaborative filtering model that simultaneously ranks all items for each user.

Module Contents

class hopwise.model.general_recommender.multivae.MultiVAE(config, dataset)[source]

Bases: hopwise.model.abstract_recommender.GeneralRecommender, hopwise.model.abstract_recommender.AutoEncoderMixin

MultiVAE is an item-based collaborative filtering model that simultaneously ranks all items for each user.

We implement the MultiVAE model with only user dataloader.

input_type
layers
lat_dim
drop_out
anneal_cap
total_anneal_steps
update = 0
encode_layer_dims
decode_layer_dims
encoder
decoder
mlp_layers(layer_dims)[source]
reparameterize(mu, logvar)[source]
forward(rating_matrix)[source]
calculate_loss(interaction)[source]

Calculate the training loss for a batch data.

Parameters:

interaction (Interaction) – Interaction class of the batch.

Returns:

Training loss, shape: []

Return type:

torch.Tensor

predict(interaction)[source]

Predict the scores between users and items.

Parameters:

interaction (Interaction) – Interaction class of the batch.

Returns:

Predicted scores for given users and items, shape: [batch_size]

Return type:

torch.Tensor

full_sort_predict(interaction)[source]

Full sort prediction function. Given users, calculate the scores between users and all candidate items.

Parameters:

interaction (Interaction) – Interaction class of the batch.

Returns:

Predicted scores for given users and all candidate items, shape: [n_batch_users * n_candidate_items]

Return type:

torch.Tensor