The neural network model for Retailrocket recommendations
In this model, we set two different variables for latent factors for users and items but set both of them to 5. The reader is welcome to experiment with different values of latent factors:
n_lf_visitor = 5 n_lf_item = 5
- Build the item and visitor embeddings and vector space representations the same way we built earlier:
item_input = Input(shape=[1],name='Items')
item_embed = Embedding(n_items + 1,
n_lf_visitor,
name='ItemsEmbedding')(item_input)
item_vec = Flatten(name='ItemsFlatten')(item_embed)
visitor_input = Input(shape=[1],name='Visitors')
visitor_embed = Embedding(n_visitors + 1,
n_lf_item,
name='VisitorsEmbedding')(visitor_input)
visitor_vec = Flatten(name='VisitorsFlatten')(visitor_embed)- Instead of creating a dot product layer, we concatenate the user and visitor representations, and then apply fully connected...