nn package¶
Submodules¶
nn.dataloader module¶
-
class
nn.dataloader.BidirectionalOneShotIterator(dataloader_head, dataloader_tail, dataloader_neg=None, neg_ratio=1)¶ Bases:
objectZincBase uses this class automatically when you want to train a model from a KB.
-
next_no_neg()¶
-
next_with_neg()¶
-
static
one_shot_iterator(dataloader)¶
-
-
class
nn.dataloader.NegDataset(neg_triples)¶ Bases:
sphinx.ext.autodoc.importer._MockObjectZincbase sets this up automatically from the knowledge base. It’s a generator used for negative examples.
-
class
nn.dataloader.TrainDataset(triples, nrelation, negative_sample_size, mode)¶ Bases:
sphinx.ext.autodoc.importer._MockObjectZincbase sets this up automatically from the knowledge base. It’s the generator for the RotatE algorithm.
-
static
collate_fn(data)¶
-
static
count_frequency(triples, start=4)¶
-
static
get_true_attr(triples)¶
-
static
get_true_head_and_tail(triples)¶
-
static
nn.rotate module¶
-
class
nn.rotate.KGEModel(model_name, nentity, nrelation, hidden_dim, gamma, double_entity_embedding=False, double_relation_embedding=False, node_attributes=[], pred_attributes=[], attr_loss_to_graph_loss=1.0, pred_loss_to_graph_loss=1.0, device='cuda')¶ Bases:
sphinx.ext.autodoc.importer._MockObject-
ComplEx(head, relation, tail, mode)¶
-
RotatE(head, relation, tail, mode)¶
-
forward(sample, mode='single', attributes=True, predict_pred_prop=False, predict_only=False)¶ A single forward pass
-
run_embedding(embedding, attribute_name)¶
-
static
train_step(model, optimizer, train_iterator, args)¶
-