merlin.models.tf.MatrixFactorizationBlock
-
merlin.models.tf.
MatrixFactorizationBlock
(schema: merlin.schema.schema.Schema, dim: int, query_id_tag=<Tags.USER_ID: 'user_id'>, item_id_tag=<Tags.ITEM_ID: 'item_id'>, embeddings_initializers: Optional[Dict[str, Callable[[Any], None]]] = None, aggregation=CosineSimilarity( (dot): <tensorflow.python.keras.layers.merge.Dot object> ), **kwargs)[source] Returns a block for Matrix Factorization, which created the user and item embeddings based on the schema and computes the dot product between user and item L2-norm embeddings
- Parameters
schema (Schema) – The Schema with the input features
dim (int) – Dimension of the user and item embeddings
query_id_tag (_type_, optional) – The tag to select the user id feature, by default Tags.USER_ID
item_id_tag (_type_, optional) – The tag to select the item id feature, by default Tags.ITEM_ID
embeddings_initializers (Optional[Dict[str, Callable[[Any], None]]], optional) – Dict where keys are feature names and values are callable to initialize embedding tables
aggregation (_type_, optional) – Aggregation of the user and item embeddings, by default CosineSimilarity()
- Returns
A block that encodes user ids and item ids into embeddings and computes their dot product
- Return type
QueryItemIdsEmbeddingsBlock