April 2020
Intermediate to advanced
330 pages
7h 44m
English
In the following code, we will add dropout layers and encourage you to experiment with different dropout rates to see what empirically leads to optimal results:
# initialize embedding parameterembedding_dim <- 64# create custom model with dropout layersdot_with_dropout <- function( embedding_dim, n_users, n_items, name = "dot_with_dropout") { keras_model_custom(name = name, function(self) { self$user_embedding <- layer_embedding( input_dim = n_users+1, output_dim = embedding_dim, name = "user_embedding") self$item_embedding <- layer_embedding( input_dim = n_items+1, output_dim = embedding_dim, name = "item_embedding") self$user_dropout <- layer_dropout( rate = 0.2) self$item_dropout <- layer_dropout( rate = 0.4) self$dot ...Read now
Unlock full access