layers.link_prediction_module
¶
Module Contents¶
Classes¶
Functions¶
|
|
|
Args: |
|
|
|
|
|
-
layers.link_prediction_module.
cal_mrr
(embedding, rel_embedding, edge_index, edge_type, scoring, protocol='raw', batch_size=1000, hits=[])[source]¶
-
class
layers.link_prediction_module.
ConvELayer
(dim, num_filter=20, kernel_size=7, k_w=10, dropout=0.3)[source]¶ Bases:
torch.nn.Module
-
layers.link_prediction_module.
sampling_edge_uniform
(edge_index, edge_types, edge_set, sampling_rate, num_rels, label_smoothing=0.0, num_entities=1)[source]¶ - Args:
edge_index: edge index of graph edge_types: edge_set: set of all edges of the graph, (h, t, r) sampling_rate: num_rels: label_smoothing(Optional): num_entities (Optional):
- Returns:
sampled_edges: sampled existing edges rels: types of smapled existing edges sampled_edges_all: existing edges with corrupted edges sampled_types_all: types of existing and corrupted edges labels: 0/1