Research Article
An Improved Sequential Recommendation Algorithm based on Short-Sequence Enhancement and Temporal Self-Attention Mechanism
Algorithm 1
The sequential recommendation algorithm proposed in this paper.
| Input: The behavior sequence of user | | Output: The recommendation list result of user , denoted as | (1) | for in do | (2) | ifthen | (3) | | (4) | else | (5) | %Date preprocessing | (6) | end if | (7) | end for | (8) | for in do | (9) | %Reverse prediction model training | (10) | end for | (11) | for in do | (12) | %Short sequence enhancement | (13) | end for | (14) | for in do | (15) | Generate time interval matrix; | (16) | Calculate time-aware self-attention model; | (17) | Apply the point-wise feed-forward network and further processed; | (18) | Calculate prediction and loss; | (19) | end for | (20) | return ; |
|