cogdl.models.emb.knowledge_base
¶
Module Contents¶
Classes¶
-
class
cogdl.models.emb.knowledge_base.
KGEModel
(nentity, nrelation, hidden_dim, gamma, double_entity_embedding=False, double_relation_embedding=False)[source]¶ Bases:
cogdl.models.BaseModel
-
forward
(self, sample, mode='single')[source]¶ Forward function that calculate the score of a batch of triples. In the ‘single’ mode, sample is a batch of triple. In the ‘head-batch’ or ‘tail-batch’ mode, sample consists two part. The first part is usually the positive sample. And the second part is the entities in the negative samples. Because negative samples and positive samples usually share two elements in their triple ((head, relation) or (relation, tail)).
-