论文阅读——LANE-Label Informed Attributed Network Embedding原理即实现

带标签数据的sku嵌入方法

方法名:Label Informed Attributed Network Embedding

简称:LANE

sku嵌入向量中应包括:user对sku的行为,sku属性,sku标签

算法基本流程

  • 从用户对sku的pv序列构造网络
  • 清洗出sku属性
  • 输入模型计算嵌入 LANE(network,attribute,(label),dim)
  • sku嵌入向量评估
  • 输入seq2seq训练
  • 预测

LANE 细节

网络的构造

论文阅读——LANE-Label Informed Attributed Network Embedding原理即实现_第1张图片

  • 从hive表里得到用户对sku的pv序列
  • 将相邻的sku关系,设置为网络中node之间有一条有向边

算法伪代码

Algorithm :Label Informed Attributed Network Embedding
Input: d d d(嵌入维度)
Input: m a x _ i t e r max\_iter max_iter(迭代次数)
Input: G G G(带权邻接矩阵)
Input: A A A(属性矩阵)
Input: α 1 \alpha _{1} α1, α 2 \alpha_{2} α2(权重参数)

Output:H(sku嵌入矩阵)

设sku数量(即构造图中的节点数量)为 n n n,sku属性的维度为 m m m, sku标签的维度为 k k k,sku嵌入向量维度为 d d d

G ∈ R n ∗ n , A ∈ R n ∗ m , Y ∈ R n ∗ k G \in R^{n*n}, A \in R^{n*m}, Y \in R^{n*k} GRnn,ARnm,YRnk

S ( G ) , S ( A ) ∈ R ( n ∗ n ) S^{(G)},S^{(A)} \in R^{(n*n)} S(G),S(A)R(nn)

L ( G ) , L ( A ) , L ( Y ) ∈ R n ∗ n L^{(G)}, L^{(A)}, L^{(Y)} \in R^{n*n} L(G),L(A),L(Y)Rnn

U ( G ) , U ( A ) , U ( Y ) , H ∈ R n ∗ d U^{(G)}, U^{(A)}, U^{(Y)},H \in R^{n*d} U(G),U(A),U(Y),HRnd

1 : Construct the affinity matrices S ( G ) S^{(G)} S(G) and S ( A ) S^{(A)} S(A)
2 : Compute Laplacian matrices L ( G ) L^{(G)} L(G) , L ( A ) L^{(A)} L(A) and L ( Y ) L^{(Y)} L(Y)
3 : Initialize t = 1 t = 1 t=1, U ( A ) = 0 , U ( Y ) = 0 , H = 0 U^{(A)}=0, U^{(Y)} =0,H=0 U(A)=0,U(Y)=0,H=0
4 : repeat
5 :      Update U ( G ) U^{(G)} U(G)
( L ( G ) + α 1 U ( A ) U ( A ) T + α 2 U ( Y ) U ( Y ) T + H H T ) U ( G ) = λ 1 U ( G ) (L^{(G)} + \alpha_{1} U^{(A)} U^{(A)^{T}} + \alpha_{2} U^{(Y)} U^{(Y)^{T}} + HH^{T})U^{(G)} = \lambda_{1}U^{(G)} (L(G)+α1U(A)U(A)T+α2U(Y)U(Y)T+HHT)U(G)=λ1U(G)
6 :      Update U ( A ) U^{(A)} U(A)
( α 1 L ( A ) + α 1 U ( G ) U ( G ) T + H H T ) U ( A ) = λ 2 U ( A ) (\alpha_{1}L^{(A)} + \alpha_{1} U^{(G)} U^{(G)^{T}} + HH^{T})U^{(A)} = \lambda_{2}U^{(A)} (α1L(A)+α1U(G)U(G)T+HHT)U(A)=λ2U(A)
7 :      Update U ( A ) U^{(A)} U(A)
( α 2 L ( Y Y ) + α 2 U ( G ) U ( G ) T + H H T ) U ( Y ) = λ 3 U ( Y ) (\alpha_{2}L^{(YY)} + \alpha_{2} U^{(G)} U^{(G)^{T}} + HH^{T})U^{(Y)} = \lambda_{3}U^{(Y)} (α2L(YY)+α2U(G)U(G)T+HHT)U(Y)=λ3U(Y)
8 :      Update H H H
( U ( G ) U ( G ) T + U ( A ) U ( A ) T + U ( Y ) U ( Y ) T ) H = λ 4 H (U^{(G)} U^{(G)^{T}} + U^{(A)} U^{(A)^{T}} + U^{(Y)} U^{(Y)^{T}})H = \lambda_{4}H (U(G)U(G)T+U(A)U(A)T+U(Y)U(Y)T)H=λ4H
9 : t = t + 1 t = t +1 t=t+1
10 : until max_iter
11 : return H

spark关键代码

你可能感兴趣的:(Network,Embedding)