merlin.schema.schema.Schema, dim: int, query_id_tag=Tags.USER_ID, item_id_tag=Tags.ITEM_ID, embeddings_initializers: Optional[Union[Dict[str, Callable[[Any], None]], Callable[[Any], None]]] = None, embeddings_l2_reg: float = 0.0, aggregation=CosineSimilarity(), **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

  • 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]]] = None) – An initializer function or a dict where keys are feature names and values are callable to initialize embedding tables

  • embeddings_l2_reg (float = 0.0) – Factor for L2 regularization of the embeddings vectors (from the current batch only)

  • aggregation (_type_, optional) – Aggregation of the user and item embeddings, by default CosineSimilarity()


A block that encodes user ids and item ids into embeddings and computes their dot product

Return type