SASRec (Sequential)
Description
The SASRec (Self-Attentive Sequential Recommendation) policy utilizes the Transformer architecture's self-attention mechanism to model user interaction sequences. By weighing the importance of all previous items, it captures both short-term and long-range dependencies to predict the next item the user is likely to interact with.
Policy Type: sasrec
Supports: embedding_policy
, scoring_policy
Configuration Example
scoring_policy_sasrec.yaml
policy_configs:
scoring_policy: # Can also be used under embedding_policy
policy_type: sasrec
# Training Hyperparameters
batch_size: 1000 # Samples per training batch
n_epochs: 1 # Number of training epochs
negative_samples_count: 2 # Negative samples per positive for contrastive loss
learning_rate: 0.001 # Optimizer learning rate
# Architecture Hyperparameters
hidden_size: 64 # Dimensionality of hidden layers/embeddings
n_heads: 2 # Number of self-attention heads
n_layers: 2 # Number of Transformer layers
attn_dropout_prob: 0.2 # Dropout rate in attention mechanism
hidden_act: "gelu" # Activation function (e.g., "gelu", "relu")
max_seq_length: 50 # Maximum input sequence length
Reference
- Kang, W. C., & McAuley, J. (2018). Self-attentive sequential recommendation. ICDM.