Research Article

A Hierarchical Network with User Memory Matrix for Long Sequence Recommendation

Algorithm 1

HNUM2.
input: triple < , , >,
output: the prediction score .
(1)group the session by users into .
(2)initialize memory-matrix:
(3)for in epoch:
(4)for in user :
(5)  //Session-level
(6)  read by reader into as preference vector
(7)  if new session
(8)   use to initialize GRU hidden state
(9)   as the weight of user interest attention
(10)  , by equation (18)
(11)  //User-level
(12)  when the end of a time step
(13)   write state to by writer
(14)  , by equation (20)
(15)  computer the loss according equation (21)
(16) end for
(17)end for