FOSSIL

Reference:

Ruining He et al. “Fusing Similarity Models with Markov Chains for Sparse Sequential Recommendation.” in ICDM 2016.

class recbole.model.sequential_recommender.fossil.FOSSIL(config, dataset)[source]

Bases: recbole.model.abstract_recommender.SequentialRecommender

FOSSIL uses similarity of the items as main purpose and uses high MC as a way of sequential preference improve of ability of sequential recommendation

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

forward(seq_item, seq_item_len, user)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

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

get_high_order_Markov(high_order_item_embedding, user)[source]

in order to get the inference of past items and the user’s taste to the current predict item

get_similarity(seq_item_embedding, seq_item_len)[source]

in order to get the inference of past items to the current predict item

init_weights(module)[source]
inverse_seq_item_embedding(seq_item_embedding, seq_item_len)[source]

inverse seq_item_embedding like this (simple to 2-dim):

[1,2,3,0,0,0] – ??? – >> [0,0,0,1,2,3]

first: [0,0,0,0,0,0] concat [1,2,3,0,0,0]

using gather_indexes: to get one by one

first get 3,then 2,last 1

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

reg_loss(user_embedding, item_embedding, seq_output)[source]
training: bool