poprox_recommender.model.nrms#
Classes
|
NRMS network. |
- class poprox_recommender.model.nrms.NRMS(config)#
Bases:
Module
NRMS network. Input 1 + K candidate news and a list of user clicked news, produce the click probability.
- forward(candidate_news, clicked_news, clicked, mode='train')#
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.
- get_news_vector(news)#
- get_user_vector(clicked_news_vector)#
- Parameters:
clicked_news_vector – batch_size, num_clicked_news_a_user, word_embedding_dim
- Returns:
(shape) batch_size, word_embedding_dim
- get_prediction(news_vector, user_vector)#
- Parameters:
news_vector – candidate_size, word_embedding_dim
user_vector – word_embedding_dim
- Returns:
candidate_size
- Return type:
click_probability
Modules