Hierarchical attentive knowledge graph embedding for personalized recommendation

本文提出了一种新颖的模型HAKG,利用层次关注的子图嵌入来捕获知识图谱中用户-物品连接的丰富语义和拓扑结构,有效减少噪声,提升个性化推荐的准确性。模型包括子图构建、实体嵌入学习(通过分层传播和自注意力机制)以及子图嵌入学习,最终用于偏好预测。

Hierarchical attentive knowledge graph embedding for personalized recommendation

1. 背景

KG可以为user和物品之间的交互提供丰富的补充信息。大多数现有的方法都不足以利用KG来捕获用户偏好,因为它们要么通过具有有限表达性的路径来表示用户-物品的连接,要么通过在整个KG上传播信息来隐式地建模,并带有不可避免的噪声。因为基于路径的方法的线性路径只能捕获用户-物品连接的部分语义,而用户-物品连接最初是由具有丰富语义和非线性拓扑的子图表示的。基于传播的方法不是直接表示用户-物品连接性,而是通过在整个KG上传播信息来隐式地对它们进行建模,其中用户偏好通常是通过聚合来自所有邻居的信息来学习的,会引入与目标物品无关的噪声。

因此作者设计看HAKG利用知识图嵌入进行有效的推荐。HAKG探索了连接KGs中用户-物品项目对的子图,以表征它们的连通性,这在概念上优于大多数现有方法,因为:(1)作为独立路径的非线性组合,子图包含KGs的丰富语义和拓扑,比线性路径更具表现力;(2)子图只保留与特定用户-物品连通性相关的实体和关系,这能够避免从整个KG引入噪声。

HAKG旨在有效地将子图的综合信息编码为低维表示(即嵌入),以更好地揭示用户偏好。子图编码是通过分层关注嵌入学习过程实现的,该过程包含两个核心步骤:(1)实体嵌入学习,通过分层传播机制学习子图中实体的嵌入。特别是,每一层基于从其邻居传播的语义更新实体嵌入,并且多层堆叠以将子图拓扑编码为学习到的实体嵌入;(2)子图嵌入学习,对实体嵌入进行聚合,得到整体子图嵌入。我们采用一种新的自注意机制来区分子图中实体的重要性,从而学习一种有效的子图嵌入,以更好地表示用户-项目的连通性。

2. 模型

在这里插入图片描述

2.1 子图构建

将子图挖掘转换为路径采样,然后组装user-item对之间的采样路径去重建子图。

  • Path Sampling
    统一采样连接user与item对的K条路径,每条路径的长度不超过6。
  • Path Assembling
    通过组合(u,i)的采样路径,得到(u,i)的子图。将路径中的object和connect映射道关系和实体。

2.2 Hierarchical attentive subgraph encoding

两个挑战:子图中有丰富的语义信息和高阶拓扑信息,以及不同实体对传播用户偏好的重要性。

分层嵌入学习过程包括:(1)实体嵌入学习,通过分层传播机制利用子图的语义和拓扑,从而学习子图中实体的有效嵌入;(2)子图嵌入学习,将实体嵌入集中起来,得到整体子图嵌入,其中利用自注意机制来区分实体的重要性。

2.2.1 实体嵌入学习

主要包括三种操作:嵌入初始化、语义传播和语义聚合。

  • Embedding Initialization

首先采用Embedding-lookup 层,找到每个实体及实体类型对应的低维嵌入向量,再将这两个向量拼接起来。
在这里插入图片描述

  • Semantics Propagation

KG中来自各种关系的丰富语义信息对理解不同用户的意图很重要,因此作者再传播过程中对异构关系进行显示建模。
在这里插入图片描述
HAKG从各种实体和关系中充分编码子图的丰富语义,有助于更好的实体嵌入学习。

  • Semantics Aggregation

语义聚合操作聚合来自邻居的语义,以细化目标实体的嵌入。
在这里插入图片描述
最终得到的实体嵌入为:
在这里插入图片描述
然后进一步对子图构造实体嵌入矩阵:
在这里插入图片描述

2.2.2 子图嵌入学习

子图嵌入学习通过集中实体嵌入生成整体子图嵌入,其中利用自注意力机制区分子图中实体的重要性以增强嵌入学习。

  • 自注意力机制
    对于有n个实体的子图,自注意力机制以实体嵌入矩阵作为输入,通过注意力网络输出图中实体的重要性:

在这里插入图片描述
其中m是注意力头数,n是子图中的实体个数。

基于注意力得分,推导出子图的嵌入:
在这里插入图片描述

2.3 偏好预测

在这里插入图片描述

### Hierarchical Embedding Model for Personalized Product Search In machine learning, hierarchical embedding models aim to capture the intricate relationships between products and user preferences by organizing items within a structured hierarchy. This approach facilitates more accurate recommendations and search results tailored specifically towards individual users' needs. A hierarchical embedding model typically involves constructing embeddings that represent both product features and their positions within a category tree or other organizational structures[^1]. For personalized product searches, this means not only capturing direct attributes of each item but also understanding how these relate across different levels of abstraction—from specific brands up through broader categories like electronics or clothing. To train such models effectively: - **Data Preparation**: Collect data on user interactions with various products along with metadata describing those goods (e.g., price range, brand name). Additionally, gather information about any existing hierarchies used in categorizing merchandise. - **Model Architecture Design**: Choose an appropriate neural network architecture capable of processing multi-level inputs while maintaining computational efficiency during training sessions. Techniques from contrastive learning can be particularly useful here as they allow systems to learn meaningful representations even when labels are scarce or noisy[^3]. - **Objective Function Formulation**: Define loss functions aimed at optimizing performance metrics relevant for ranking tasks; minimizing negative log-likelihood serves well as it encourages correct predictions over incorrect ones[^4]. Here’s a simplified example using Python code snippet demonstrating part of what might go into building one aspect of this kind of system—learning embeddings based off some hypothetical dataset containing customer reviews alongside associated product IDs: ```python import torch from torch import nn class HierarchicalEmbedder(nn.Module): def __init__(self, vocab_size, embed_dim=100): super().__init__() self.embedding = nn.Embedding(vocab_size, embed_dim) def forward(self, x): return self.embedding(x) # Example usage: vocab_size = 5000 # Number of unique words/products embeddings_model = HierarchicalEmbedder(vocab_size) input_tensor = torch.LongTensor([i for i in range(10)]) # Simulated input indices output_embeddings = embeddings_model(input_tensor) print(output_embeddings.shape) # Should output something similar to "torch.Size([10, 100])" ``` This script initializes a simple PyTorch module designed to generate fixed-size vector outputs corresponding to given integer keys representing either textual tokens found within review texts or numeric identifiers assigned uniquely per catalog entry.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值