赞
踩
Translating Embeddings for Modeling Multi-relational Data
实体向量 + 关系向量 = 实体向量 (h+l = t)
https://github.com/wuxiyu/transE/blob/master/tranE.py
关键代码片段
def update(self, Tbatch):
copyEntityList = deepcopy(self.entityList)
copyRelationList = deepcopy(self.relationList)
for tripletWithCorruptedTriplet in Tbatch:
headEntityVector = copyEntityList[tripletWithCorruptedTriplet[0][0]]#tripletWithCorruptedTriplet是原三元组和打碎的三元组的元组tuple
tailEntityVector = copyEntityList[tripletWithCorruptedTriplet[0][1]]
relationVector = copyRelationList[tripletWithCorruptedTriplet[0][2]]
headEntityVectorWithCorruptedTriplet = copyEntityList[tripletWithCorruptedT
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。