From 96339f19e02263c0f4157172428012fc8433ba21 Mon Sep 17 00:00:00 2001 From: AlCatt91 <> Date: Wed, 8 Nov 2023 15:58:42 +0000 Subject: [PATCH] AlCatt91 published a site update --- _modules/besskge/embedding.html | 18 + _modules/besskge/scoring.html | 219 ++++++++++- ...besskge.embedding.init_xavier_norm.rst.txt | 6 + _sources/generated/besskge.embedding.rst.txt | 1 + .../generated/besskge.scoring.ConvE.rst.txt | 12 + _sources/generated/besskge.scoring.rst.txt | 1 + generated/besskge.dataset.KGDataset.html | 4 +- generated/besskge.embedding.html | 10 +- .../besskge.embedding.init_KGE_normal.html | 1 + .../besskge.embedding.init_KGE_uniform.html | 1 + .../besskge.embedding.init_uniform_norm.html | 5 +- .../besskge.embedding.init_xavier_norm.html | 160 ++++++++ ...embedding.initialize_entity_embedding.html | 5 +- ...bedding.initialize_relation_embedding.html | 1 + ...embedding.refactor_embedding_sharding.html | 1 + .../besskge.scoring.BaseScoreFunction.html | 1 + generated/besskge.scoring.BoxE.html | 3 +- generated/besskge.scoring.ComplEx.html | 7 +- generated/besskge.scoring.ConvE.html | 367 ++++++++++++++++++ generated/besskge.scoring.DistMult.html | 7 +- ...ge.scoring.DistanceBasedScoreFunction.html | 1 + generated/besskge.scoring.InterHT.html | 3 +- ...ring.MatrixDecompositionScoreFunction.html | 1 + generated/besskge.scoring.PairRE.html | 3 +- generated/besskge.scoring.RotatE.html | 3 +- generated/besskge.scoring.TranS.html | 3 +- generated/besskge.scoring.TransE.html | 3 +- generated/besskge.scoring.TripleRE.html | 3 +- generated/besskge.scoring.html | 36 +- genindex.html | 34 +- index.html | 2 + objects.inv | Bin 4893 -> 5038 bytes searchindex.js | 2 +- 33 files changed, 872 insertions(+), 52 deletions(-) create mode 100644 _sources/generated/besskge.embedding.init_xavier_norm.rst.txt create mode 100644 _sources/generated/besskge.scoring.ConvE.rst.txt create mode 100644 generated/besskge.embedding.init_xavier_norm.html create mode 100644 generated/besskge.scoring.ConvE.html diff --git a/_modules/besskge/embedding.html b/_modules/besskge/embedding.html index 9c3af28..e7e8b24 100644 --- a/_modules/besskge/embedding.html +++ b/_modules/besskge/embedding.html @@ -100,6 +100,24 @@
return torch.nn.functional.normalize(torch.nn.init.uniform(embedding_table), dim=-1)
init_KGE_normal,
init_KGE_uniform,
init_uniform_norm,
+ init_xavier_norm,
initialize_entity_embedding,
initialize_relation_embedding,
refactor_embedding_sharding,
@@ -365,7 +366,7 @@ Source code for besskge.scoring
:param relation_initializer:
Initialization function or table for relation embeddings.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(TransE, self).__init__(
negative_sample_sharing=negative_sample_sharing, scoring_norm=scoring_norm
@@ -465,7 +466,7 @@ Source code for besskge.scoring
:param relation_initializer:
Initialization function or table for relation embeddings.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(RotatE, self).__init__(
negative_sample_sharing=negative_sample_sharing, scoring_norm=scoring_norm
@@ -576,7 +577,7 @@ Source code for besskge.scoring
If True, L2-normalize head and tail entity embeddings before projecting,
as in :cite:p:`PairRE`. Default: True.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(PairRE, self).__init__(
negative_sample_sharing=negative_sample_sharing, scoring_norm=scoring_norm
@@ -711,7 +712,7 @@ Source code for besskge.scoring
Offset factor for head/tail relation projections, as in TripleREv2.
Default: 0.0 (no offset).
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(TripleRE, self).__init__(
negative_sample_sharing=negative_sample_sharing, scoring_norm=scoring_norm
@@ -850,7 +851,7 @@ Source code for besskge.scoring
:param relation_initializer:
Initialization function or table for relation embeddings.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(DistMult, self).__init__(negative_sample_sharing=negative_sample_sharing)
@@ -944,7 +945,7 @@ Source code for besskge.scoring
:param relation_initializer:
Initialization function or table for relation embeddings.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(ComplEx, self).__init__(negative_sample_sharing=negative_sample_sharing)
@@ -1018,6 +1019,206 @@ Source code for besskge.scoring
)
+[docs]class ConvE(MatrixDecompositionScoreFunction):
+ """
+ ConvE scoring function :cite:p:`ConvE`.
+
+ Note that, differently from :cite:p:`ConvE`, the scores returned by this class
+ have not been passed through a final sigmoid layer, as we assume that this is
+ included in the loss function.
+
+ By design, this scoring function should be used in combination with a
+ negative/candidate sampler that only corrupts tails (possibly after
+ including all inverse triples in the dataset, see the `add_inverse_triples`
+ argument in :func:`besskge.sharding.PartitionedTripleSet.create_from_dataset`).
+ """
+
+ def __init__(
+ self,
+ negative_sample_sharing: bool,
+ sharding: Sharding,
+ n_relation_type: int,
+ embedding_size: int,
+ embedding_height: int,
+ embedding_width: int,
+ entity_initializer: Union[torch.Tensor, List[Callable[..., torch.Tensor]]] = [
+ init_xavier_norm,
+ torch.nn.init.zeros_,
+ ],
+ relation_initializer: Union[torch.Tensor, List[Callable[..., torch.Tensor]]] = [
+ init_xavier_norm,
+ ],
+ inverse_relations: bool = True,
+ input_channels: int = 1,
+ output_channels: int = 32,
+ kernel_height: int = 3,
+ kernel_width: int = 3,
+ input_dropout: float = 0.2,
+ feature_map_dropout: float = 0.2,
+ hidden_dropout: float = 0.3,
+ batch_normalization: bool = True,
+ ) -> None:
+ """
+ Initialize ConvE model.
+
+ :param negative_sample_sharing:
+ see :meth:`DistanceBasedScoreFunction.__init__`
+ :param sharding:
+ Entity sharding.
+ :param n_relation_type:
+ Number of relation types in the knowledge graph.
+ :param embedding_size:
+ Size of entity and relation embeddings.
+ :param embedding_height:
+ Height of the 2D-reshaping of the concatenation of
+ head and relation embeddings.
+ :param embedding_width:
+ Width of the 2D-reshaping of the concatenation of
+ head and relation embeddings.
+ :param entity_initializer:
+ Initialization functions or table for entity embeddings.
+ If not passing a table, two functions are needed: the initializer
+ for entity embeddings and initializer for (scalar) tail biases.
+ :param relation_initializer:
+ Initialization function or table for relation embeddings.
+ :param inverse_relations:
+ If True, learn embeddings for inverse relations. Default: True.
+ :param input_channels:
+ Number of input channels of the Conv2D operator. Default: 1.
+ :param output_channels:
+ Number of output channels of the Conv2D operator. Default: 32.
+ :param kernel_height:
+ Height of the Conv2D kernel. Default: 3.
+ :param kernel_width:
+ Width of the Conv2D kernel. Default: 3.
+ :param input_dropout:
+ Rate of Dropout applied before the convolution. Default: 0.2.
+ :param feature_map_dropout:
+ Rate of Dropout applied after the convolution. Default: 0.2.
+ :param hidden_dropout:
+ Rate of Dropout applied after the Linear layer. Default: 0.3.
+ :param batch_normalization:
+ If True, apply batch normalization before and after the
+ convolution and after the Linear layer. Default: True.
+ """
+ super(ConvE, self).__init__(negative_sample_sharing=negative_sample_sharing)
+
+ self.sharding = sharding
+
+ if input_channels * embedding_width * embedding_height != embedding_size:
+ raise ValueError(
+ "`embedding_size` needs to be equal to"
+ " `input_channels * embedding_width * embedding_height`"
+ )
+
+ # self.entity_embedding[..., :embedding_size] entity_embeddings
+ # self.entity_embedding[..., -1] tail biases
+ self.entity_embedding = initialize_entity_embedding(
+ self.sharding, entity_initializer, [embedding_size, 1]
+ )
+ self.relation_embedding = initialize_relation_embedding(
+ n_relation_type, inverse_relations, relation_initializer, [embedding_size]
+ )
+ assert (
+ self.entity_embedding.shape[-1] - 1
+ == self.relation_embedding.shape[-1]
+ == embedding_size
+ ), (
+ "ConvE requires `embedding_size + 1` embedding parameters for each entity"
+ " and `embedding_size` embedding parameters for each relation"
+ )
+ self.embedding_size = embedding_size
+
+ self.inp_channels = input_channels
+ self.emb_h = embedding_height
+ self.emb_w = embedding_width
+ conv_layers = [
+ torch.nn.Dropout(input_dropout),
+ torch.nn.Conv2d(
+ in_channels=self.inp_channels,
+ out_channels=output_channels,
+ kernel_size=(kernel_height, kernel_width),
+ ),
+ torch.nn.ReLU(),
+ torch.nn.Dropout2d(feature_map_dropout),
+ ]
+ fc_layers = [
+ torch.nn.Linear(
+ output_channels
+ * (2 * self.emb_h - kernel_height + 1)
+ * (self.emb_w - kernel_width + 1),
+ embedding_size,
+ ),
+ torch.nn.Dropout(hidden_dropout),
+ torch.nn.ReLU(),
+ ]
+ if batch_normalization:
+ conv_layers.insert(0, torch.nn.BatchNorm2d(input_channels))
+ conv_layers.insert(3, torch.nn.BatchNorm2d(output_channels))
+ fc_layers.insert(2, torch.nn.BatchNorm1d(embedding_size))
+ self.conv_layers = torch.nn.Sequential(*conv_layers)
+ self.fc_layers = torch.nn.Sequential(*fc_layers)
+
+ # docstr-coverage: inherited
+[docs] def score_triple(
+ self,
+ head_emb: torch.Tensor,
+ relation_id: torch.Tensor,
+ tail_emb: torch.Tensor,
+ ) -> torch.Tensor:
+ relation_emb = torch.index_select(
+ self.relation_embedding, index=relation_id, dim=0
+ )
+ # Discard bias for heads
+ head_emb = head_emb[..., :-1]
+ tail_emb, tail_bias = torch.split(tail_emb, self.embedding_size, dim=-1)
+ hr_cat = torch.cat(
+ [
+ head_emb.view(-1, self.inp_channels, self.emb_h, self.emb_w),
+ relation_emb.view(-1, self.inp_channels, self.emb_h, self.emb_w),
+ ],
+ dim=-2,
+ )
+ hr_conv = self.fc_layers(self.conv_layers(hr_cat).flatten(start_dim=1))
+ return self.reduce_embedding(hr_conv * tail_emb) + tail_bias.squeeze(-1)
+
+ # docstr-coverage: inherited
+[docs] def score_heads(
+ self,
+ head_emb: torch.Tensor,
+ relation_id: torch.Tensor,
+ tail_emb: torch.Tensor,
+ ) -> torch.Tensor:
+ raise NotImplementedError("ConvE should not be used with head corruption")
+
+ # docstr-coverage: inherited
+[docs] def score_tails(
+ self,
+ head_emb: torch.Tensor,
+ relation_id: torch.Tensor,
+ tail_emb: torch.Tensor,
+ ) -> torch.Tensor:
+ relation_emb = torch.index_select(
+ self.relation_embedding, index=relation_id, dim=0
+ )
+ # Discard bias for heads
+ head_emb = head_emb[..., :-1]
+ tail_emb, tail_bias = torch.split(tail_emb, self.embedding_size, dim=-1)
+ if self.negative_sample_sharing:
+ tail_bias = tail_bias.view(1, -1)
+ else:
+ tail_bias = tail_bias.squeeze(-1)
+ hr_cat = torch.cat(
+ [
+ head_emb.view(-1, self.inp_channels, self.emb_h, self.emb_w),
+ relation_emb.view(-1, self.inp_channels, self.emb_h, self.emb_w),
+ ],
+ dim=-2,
+ )
+ hr_conv = self.fc_layers(self.conv_layers(hr_cat).flatten(start_dim=1))
+ return self.broadcasted_dot_product(hr_conv, tail_emb) + tail_bias
+
+
[docs]class BoxE(DistanceBasedScoreFunction):
"""
BoxE scoring function :cite:p:`BoxE`.
@@ -1074,7 +1275,7 @@ Source code for besskge.scoring
Softening parameter for geometric normalization of box widths.
Default: 1e-6.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(BoxE, self).__init__(
negative_sample_sharing=negative_sample_sharing, scoring_norm=scoring_norm
@@ -1332,7 +1533,7 @@ Source code for besskge.scoring
:param offset:
Offset applied to auxiliary entity embeddings. Default: 1.0.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(InterHT, self).__init__(
negative_sample_sharing=negative_sample_sharing, scoring_norm=scoring_norm
@@ -1489,7 +1690,7 @@ Source code for besskge.scoring
:param offset:
Offset applied to tilde entity embeddings. Default: 1.0.
:param inverse_relations:
- If True, learn embeddings for inverse relations. Default: False
+ If True, learn embeddings for inverse relations. Default: False.
"""
super(TranS, self).__init__(
negative_sample_sharing=negative_sample_sharing, scoring_norm=scoring_norm
diff --git a/_sources/generated/besskge.embedding.init_xavier_norm.rst.txt b/_sources/generated/besskge.embedding.init_xavier_norm.rst.txt
new file mode 100644
index 0000000..ced220a
--- /dev/null
+++ b/_sources/generated/besskge.embedding.init_xavier_norm.rst.txt
@@ -0,0 +1,6 @@
+besskge.embedding.init\_xavier\_norm
+====================================
+
+.. currentmodule:: besskge.embedding
+
+.. autofunction:: init_xavier_norm
\ No newline at end of file
diff --git a/_sources/generated/besskge.embedding.rst.txt b/_sources/generated/besskge.embedding.rst.txt
index 0f9b9d7..901b5be 100644
--- a/_sources/generated/besskge.embedding.rst.txt
+++ b/_sources/generated/besskge.embedding.rst.txt
@@ -21,6 +21,7 @@ besskge.embedding
init_KGE_normal
init_KGE_uniform
init_uniform_norm
+ init_xavier_norm
initialize_entity_embedding
initialize_relation_embedding
refactor_embedding_sharding
diff --git a/_sources/generated/besskge.scoring.ConvE.rst.txt b/_sources/generated/besskge.scoring.ConvE.rst.txt
new file mode 100644
index 0000000..8240814
--- /dev/null
+++ b/_sources/generated/besskge.scoring.ConvE.rst.txt
@@ -0,0 +1,12 @@
+..
+ # Copyright (c) 2023 Graphcore Ltd. All rights reserved.
+ # Copyright (c) 2007-2023 by the Sphinx team. All rights reserved.
+
+besskge.scoring.ConvE
+=====================
+
+.. currentmodule:: besskge.scoring
+
+.. autoclass:: ConvE
+ :members:
+ :inherited-members: Module
\ No newline at end of file
diff --git a/_sources/generated/besskge.scoring.rst.txt b/_sources/generated/besskge.scoring.rst.txt
index dd39740..0fbbdc5 100644
--- a/_sources/generated/besskge.scoring.rst.txt
+++ b/_sources/generated/besskge.scoring.rst.txt
@@ -26,6 +26,7 @@ besskge.scoring
BaseScoreFunction
BoxE
ComplEx
+ ConvE
DistMult
DistanceBasedScoreFunction
InterHT
diff --git a/generated/besskge.dataset.KGDataset.html b/generated/besskge.dataset.KGDataset.html
index 49baa16..7d5eba9 100644
--- a/generated/besskge.dataset.KGDataset.html
+++ b/generated/besskge.dataset.KGDataset.html
@@ -222,12 +222,12 @@ besskge.dataset.KGDataset
Parameters:
-df (Union
[DataFrame
, Dict
[str
, DataFrame
]]) – Pandas DataFrame of all triples in the knowledge graph dataset,
+
df (Union
[DataFrame
, Dict
[str
, DataFrame
]]) – Pandas DataFrame of all triples in the knowledge graph dataset,
or dictionary of DataFrames of triples for each part of the dataset split
head_column (Union
[int
, str
]) – Name of the DataFrame column storing head entities
relation_column (Union
[int
, str
]) – Name of the DataFrame column storing relations
tail_column (Union
[int
, str
]) – Name of the DataFrame column storing tail entities
-entity_types (Union
[Series
, Dict
[str
, str
], None
]) – If entities have types, dictionary or pandas Series of mappings
+
entity_types (Union
[Series
, Dict
[str
, str
], None
]) – If entities have types, dictionary or pandas Series of mappings
entity label -> entity type (as strings).
split (Tuple
[float
, float
, float
]) – Tuple to set the train/validation/test split.
Only used if no pre-defined dataset split is specified,
diff --git a/generated/besskge.embedding.html b/generated/besskge.embedding.html
index 78cfb42..5a9e0b8 100644
--- a/generated/besskge.embedding.html
+++ b/generated/besskge.embedding.html
@@ -59,6 +59,7 @@
- besskge.embedding.init_KGE_normal
- besskge.embedding.init_KGE_uniform
- besskge.embedding.init_uniform_norm
+- besskge.embedding.init_xavier_norm
- besskge.embedding.initialize_entity_embedding
- besskge.embedding.initialize_relation_embedding
- besskge.embedding.refactor_embedding_sharding
@@ -111,13 +112,16 @@
init_uniform_norm
(embedding_table)
Initialize embeddings according to uniform distribution and normalize so that each row has norm 1.
-initialize_entity_embedding
(sharding, ...[, ...])
+init_xavier_norm
(embedding_table[, gain])
+Initialize embeddings according to Xavier normal scheme, with fan_in = 0, fan_out=row_size.
+
+initialize_entity_embedding
(sharding, ...[, ...])
Initialize entity embedding table.
-initialize_relation_embedding
(...[, row_size])
+initialize_relation_embedding
(...[, row_size])
Initialize relation embedding table.
-
+
Refactor sharded entity embedding table to pass from one entity sharding to a different one.
diff --git a/generated/besskge.embedding.init_KGE_normal.html b/generated/besskge.embedding.init_KGE_normal.html
index 5ad0e1d..0035a49 100644
--- a/generated/besskge.embedding.init_KGE_normal.html
+++ b/generated/besskge.embedding.init_KGE_normal.html
@@ -62,6 +62,7 @@
- besskge.embedding.init_KGE_uniform
- besskge.embedding.init_uniform_norm
+- besskge.embedding.init_xavier_norm
- besskge.embedding.initialize_entity_embedding
- besskge.embedding.initialize_relation_embedding
- besskge.embedding.refactor_embedding_sharding
diff --git a/generated/besskge.embedding.init_KGE_uniform.html b/generated/besskge.embedding.init_KGE_uniform.html
index 553f276..4d0f1e7 100644
--- a/generated/besskge.embedding.init_KGE_uniform.html
+++ b/generated/besskge.embedding.init_KGE_uniform.html
@@ -62,6 +62,7 @@
besskge.embedding.init_uniform_norm
+besskge.embedding.init_xavier_norm
besskge.embedding.initialize_entity_embedding
besskge.embedding.initialize_relation_embedding
besskge.embedding.refactor_embedding_sharding
diff --git a/generated/besskge.embedding.init_uniform_norm.html b/generated/besskge.embedding.init_uniform_norm.html
index 423faae..036d1b5 100644
--- a/generated/besskge.embedding.init_uniform_norm.html
+++ b/generated/besskge.embedding.init_uniform_norm.html
@@ -18,7 +18,7 @@
-
+
@@ -62,6 +62,7 @@
init_uniform_norm()
+besskge.embedding.init_xavier_norm
besskge.embedding.initialize_entity_embedding
besskge.embedding.initialize_relation_embedding
besskge.embedding.refactor_embedding_sharding
@@ -127,7 +128,7 @@ besskge.embedding.init_uniform_norm
Previous
- Next
+ Next
diff --git a/generated/besskge.embedding.init_xavier_norm.html b/generated/besskge.embedding.init_xavier_norm.html
new file mode 100644
index 0000000..4d22e0f
--- /dev/null
+++ b/generated/besskge.embedding.init_xavier_norm.html
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+ besskge.embedding.init_xavier_norm — BESS-KGE documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/generated/besskge.embedding.initialize_entity_embedding.html b/generated/besskge.embedding.initialize_entity_embedding.html
index 85624e2..a97967b 100644
--- a/generated/besskge.embedding.initialize_entity_embedding.html
+++ b/generated/besskge.embedding.initialize_entity_embedding.html
@@ -19,7 +19,7 @@
-
+
@@ -59,6 +59,7 @@
besskge.embedding.init_KGE_normal
besskge.embedding.init_KGE_uniform
besskge.embedding.init_uniform_norm
+besskge.embedding.init_xavier_norm
besskge.embedding.initialize_entity_embedding
@@ -139,7 +140,7 @@ besskge.embedding.initialize_entity_embedding
- Previous
+ Previous
Next
diff --git a/generated/besskge.embedding.initialize_relation_embedding.html b/generated/besskge.embedding.initialize_relation_embedding.html
index 0fbc006..e137d13 100644
--- a/generated/besskge.embedding.initialize_relation_embedding.html
+++ b/generated/besskge.embedding.initialize_relation_embedding.html
@@ -59,6 +59,7 @@
besskge.embedding.init_KGE_normal
besskge.embedding.init_KGE_uniform
besskge.embedding.init_uniform_norm
+besskge.embedding.init_xavier_norm
besskge.embedding.initialize_entity_embedding
besskge.embedding.initialize_relation_embedding
initialize_relation_embedding()
diff --git a/generated/besskge.embedding.refactor_embedding_sharding.html b/generated/besskge.embedding.refactor_embedding_sharding.html
index 1fb6b73..4479e3d 100644
--- a/generated/besskge.embedding.refactor_embedding_sharding.html
+++ b/generated/besskge.embedding.refactor_embedding_sharding.html
@@ -59,6 +59,7 @@
- besskge.embedding.init_KGE_normal
- besskge.embedding.init_KGE_uniform
- besskge.embedding.init_uniform_norm
+- besskge.embedding.init_xavier_norm
- besskge.embedding.initialize_entity_embedding
- besskge.embedding.initialize_relation_embedding
- besskge.embedding.refactor_embedding_sharding
diff --git a/generated/besskge.scoring.BaseScoreFunction.html b/generated/besskge.scoring.BaseScoreFunction.html
index e25588a..b3714ee 100644
--- a/generated/besskge.scoring.BaseScoreFunction.html
+++ b/generated/besskge.scoring.BaseScoreFunction.html
@@ -59,6 +59,7 @@
- besskge.scoring.BoxE
- besskge.scoring.ComplEx
+- besskge.scoring.ConvE
- besskge.scoring.DistMult
- besskge.scoring.DistanceBasedScoreFunction
- besskge.scoring.InterHT
diff --git a/generated/besskge.scoring.BoxE.html b/generated/besskge.scoring.BoxE.html
index 68f5418..9c65b1e 100644
--- a/generated/besskge.scoring.BoxE.html
+++ b/generated/besskge.scoring.BoxE.html
@@ -59,6 +59,7 @@
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -134,7 +135,7 @@ besskge.scoring.BoxE
eps (float
) – Softening parameter for geometric normalization of box widths.
Default: 1e-6.
-inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
diff --git a/generated/besskge.scoring.ComplEx.html b/generated/besskge.scoring.ComplEx.html
index 2354795..eceab6d 100644
--- a/generated/besskge.scoring.ComplEx.html
+++ b/generated/besskge.scoring.ComplEx.html
@@ -18,7 +18,7 @@
-
+
@@ -59,6 +59,7 @@
ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -122,7 +123,7 @@ besskge.scoring.ComplExembedding_size (int
) – Complex size of entity and relation embeddings.
entity_initializer (Union
[Tensor
, List
[Callable
[...
, Tensor
]]]) – Initialization function or table for entity embeddings.
relation_initializer (Union
[Tensor
, List
[Callable
[...
, Tensor
]]]) – Initialization function or table for relation embeddings.
-inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
@@ -315,7 +316,7 @@ besskge.scoring.ComplEx
diff --git a/generated/besskge.scoring.DistanceBasedScoreFunction.html b/generated/besskge.scoring.DistanceBasedScoreFunction.html
index 1a795bd..a32fdf9 100644
--- a/generated/besskge.scoring.DistanceBasedScoreFunction.html
+++ b/generated/besskge.scoring.DistanceBasedScoreFunction.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
DistanceBasedScoreFunction
diff --git a/generated/besskge.scoring.InterHT.html b/generated/besskge.scoring.InterHT.html
index 853326b..4b1b5ad 100644
--- a/generated/besskge.scoring.InterHT.html
+++ b/generated/besskge.scoring.InterHT.html
@@ -56,6 +56,7 @@
- besskge.scoring.BaseScoreFunction
- besskge.scoring.BoxE
- besskge.scoring.ComplEx
+- besskge.scoring.ConvE
- besskge.scoring.DistMult
- besskge.scoring.DistanceBasedScoreFunction
- besskge.scoring.InterHT
offset (float
) – Offset applied to auxiliary entity embeddings. Default: 1.0.
-inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
diff --git a/generated/besskge.scoring.MatrixDecompositionScoreFunction.html b/generated/besskge.scoring.MatrixDecompositionScoreFunction.html
index 1adbd00..578e97a 100644
--- a/generated/besskge.scoring.MatrixDecompositionScoreFunction.html
+++ b/generated/besskge.scoring.MatrixDecompositionScoreFunction.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
diff --git a/generated/besskge.scoring.PairRE.html b/generated/besskge.scoring.PairRE.html
index 9a8f71c..31be1fd 100644
--- a/generated/besskge.scoring.PairRE.html
+++ b/generated/besskge.scoring.PairRE.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -125,7 +126,7 @@ besskge.scoring.PairRErelation_initializer (Union
[Tensor
, List
[Callable
[...
, Tensor
]]]) – Initialization function or table for relation embeddings.
normalize_entities (bool
) – If True, L2-normalize head and tail entity embeddings before projecting,
as in [CHWC21]. Default: True.
-inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
diff --git a/generated/besskge.scoring.RotatE.html b/generated/besskge.scoring.RotatE.html
index 9606fbe..4d010d4 100644
--- a/generated/besskge.scoring.RotatE.html
+++ b/generated/besskge.scoring.RotatE.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -124,7 +125,7 @@ besskge.scoring.RotatE
entity_initializer (Union
[Tensor
, List
[Callable
[...
, Tensor
]]]) – Initialization function or table for entity embeddings.
relation_initializer (Union
[Tensor
, List
[Callable
[...
, Tensor
]]]) – Initialization function or table for relation embeddings.
-inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
diff --git a/generated/besskge.scoring.TranS.html b/generated/besskge.scoring.TranS.html
index 280e2e1..d9b3571 100644
--- a/generated/besskge.scoring.TranS.html
+++ b/generated/besskge.scoring.TranS.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -126,7 +127,7 @@ besskge.scoring.TranSnormalize_entities (bool
) – If True, L2-normalize embeddings of head and tail entities as well as
tilde head and tail entities before multiplying. Default: True.
offset (float
) – Offset applied to tilde entity embeddings. Default: 1.0.
-inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
diff --git a/generated/besskge.scoring.TransE.html b/generated/besskge.scoring.TransE.html
index 9046559..8a9df7f 100644
--- a/generated/besskge.scoring.TransE.html
+++ b/generated/besskge.scoring.TransE.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -123,7 +124,7 @@ besskge.scoring.TransEembedding_size (int
) – Size of entity and relation embeddings.
entity_initializer (Union
[Tensor
, List
[Callable
[...
, Tensor
]]]) – Initialization function or table for entity embeddings.
relation_initializer (Union
[Tensor
, List
[Callable
[...
, Tensor
]]]) – Initialization function or table for relation embeddings.
-inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
diff --git a/generated/besskge.scoring.TripleRE.html b/generated/besskge.scoring.TripleRE.html
index 994fd02..35b2d9c 100644
--- a/generated/besskge.scoring.TripleRE.html
+++ b/generated/besskge.scoring.TripleRE.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -127,7 +128,7 @@ besskge.scoring.TripleREfloat
) – Offset factor for head/tail relation projections, as in TripleREv2.
Default: 0.0 (no offset).
-
inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False
+inverse_relations (bool
) – If True, learn embeddings for inverse relations. Default: False.
diff --git a/generated/besskge.scoring.html b/generated/besskge.scoring.html
index 56fcc73..55e0406 100644
--- a/generated/besskge.scoring.html
+++ b/generated/besskge.scoring.html
@@ -56,6 +56,7 @@
besskge.scoring.BaseScoreFunction
besskge.scoring.BoxE
besskge.scoring.ComplEx
+besskge.scoring.ConvE
besskge.scoring.DistMult
besskge.scoring.DistanceBasedScoreFunction
besskge.scoring.InterHT
@@ -118,32 +119,35 @@
ComplEx
(negative_sample_sharing, sharding, ...)
ComplEx scoring function [TWR+16].
-DistMult
(negative_sample_sharing, sharding, ...)
-DistMult scoring function [YYH+15].
+ConvE
(negative_sample_sharing, sharding, ...)
+ConvE scoring function [DPPR18].
-
+DistMult
(negative_sample_sharing, sharding, ...)
+DistMult scoring function [YYH+15].
+
+
Base class for distance-based scoring functions.
-InterHT
(negative_sample_sharing, ...[, ...])
-InterHT scoring function [WMW+22].
+InterHT
(negative_sample_sharing, ...[, ...])
+InterHT scoring function [WMW+22].
-
+
Base class for matrix-decomposition scoring functions.
-PairRE
(negative_sample_sharing, ...[, ...])
-PairRE scoring function [CHWC21].
+PairRE
(negative_sample_sharing, ...[, ...])
+PairRE scoring function [CHWC21].
-RotatE
(negative_sample_sharing, ...[, ...])
-RotatE scoring function [SDNT19].
+RotatE
(negative_sample_sharing, ...[, ...])
+RotatE scoring function [SDNT19].
-TranS
(negative_sample_sharing, scoring_norm, ...)
-TranS scoring function [ZYX22].
+TranS
(negative_sample_sharing, scoring_norm, ...)
+TranS scoring function [ZYX22].
-TransE
(negative_sample_sharing, ...[, ...])
-TransE scoring function [BUGD+13].
+TransE
(negative_sample_sharing, ...[, ...])
+TransE scoring function [BUGD+13].
-TripleRE
(negative_sample_sharing, ...[, ...])
-TripleRE scoring function [YLL+22].
+TripleRE
(negative_sample_sharing, ...[, ...])
+TripleRE scoring function [YLL+22].
diff --git a/genindex.html b/genindex.html
index e3be28c..30d510a 100644
--- a/genindex.html
+++ b/genindex.html
@@ -181,8 +181,6 @@ B
module
-
-
-
besskge.scoring
@@ -190,6 +188,8 @@
B
- module
+
+
-
besskge.sharding
@@ -229,6 +229,8 @@
B
- broadcasted_dot_product() (besskge.scoring.ComplEx method)
+ - (besskge.scoring.ConvE method)
+
- (besskge.scoring.DistMult method)
- (besskge.scoring.MatrixDecompositionScoreFunction method)
@@ -253,6 +255,8 @@
C
- complex_multiplication() (in module besskge.utils)
- complex_rotation() (in module besskge.utils)
+
+ - ConvE (class in besskge.scoring)
- corruption_scheme (besskge.negative_sampler.PlaceholderNegativeSampler attribute)
@@ -306,6 +310,8 @@
E
- (besskge.scoring.BoxE attribute)
- (besskge.scoring.ComplEx attribute)
+
+ - (besskge.scoring.ConvE attribute)
- (besskge.scoring.DistanceBasedScoreFunction attribute)
@@ -384,6 +390,8 @@ F
- (besskge.scoring.BoxE method)
- (besskge.scoring.ComplEx method)
+
+ - (besskge.scoring.ConvE method)
- (besskge.scoring.DistanceBasedScoreFunction method)
@@ -473,6 +481,8 @@ I
- init_KGE_uniform() (in module besskge.embedding)
- init_uniform_norm() (in module besskge.embedding)
+
+ - init_xavier_norm() (in module besskge.embedding)
@@ -625,8 +635,6 @@ N
- (besskge.loss.SampledSoftmaxCrossEntropyLoss attribute)
-
-
+
- negative_sample_sharing (besskge.scoring.BaseScoreFunction attribute)
- (besskge.scoring.BoxE attribute)
- (besskge.scoring.ComplEx attribute)
+
+ - (besskge.scoring.ConvE attribute)
- (besskge.scoring.DistanceBasedScoreFunction attribute)
@@ -703,6 +715,8 @@ R
- (besskge.scoring.ComplEx method)
+
+ - (besskge.scoring.ConvE method)
- (besskge.scoring.DistanceBasedScoreFunction method)
@@ -735,6 +749,8 @@ R
- (besskge.scoring.BoxE attribute)
- (besskge.scoring.ComplEx attribute)
+
+ - (besskge.scoring.ConvE attribute)
- (besskge.scoring.DistanceBasedScoreFunction attribute)
@@ -807,6 +823,8 @@ S
- (besskge.scoring.BoxE method)
- (besskge.scoring.ComplEx method)
+
+ - (besskge.scoring.ConvE method)
- (besskge.scoring.DistanceBasedScoreFunction method)
@@ -833,6 +851,8 @@ S
- (besskge.scoring.BoxE method)
- (besskge.scoring.ComplEx method)
+
+ - (besskge.scoring.ConvE method)
- (besskge.scoring.DistanceBasedScoreFunction method)
@@ -861,6 +881,8 @@ S
- (besskge.scoring.BoxE method)
- (besskge.scoring.ComplEx method)
+
+ - (besskge.scoring.ConvE method)
- (besskge.scoring.DistanceBasedScoreFunction method)
@@ -899,6 +921,8 @@ S
- (besskge.scoring.BoxE attribute)
- (besskge.scoring.ComplEx attribute)
+
+ - (besskge.scoring.ConvE attribute)
- (besskge.scoring.DistanceBasedScoreFunction attribute)
@@ -973,6 +997,8 @@ U
- (besskge.scoring.BoxE method)
- (besskge.scoring.ComplEx method)
+
+ - (besskge.scoring.ConvE method)
- (besskge.scoring.DistanceBasedScoreFunction method)
diff --git a/index.html b/index.html
index 54ee68c..3a13deb 100644
--- a/index.html
+++ b/index.html
@@ -142,6 +142,7 @@
- besskge.scoring.BaseScoreFunction
- besskge.scoring.BoxE
- besskge.scoring.ComplEx
+- besskge.scoring.ConvE
- besskge.scoring.DistMult
- besskge.scoring.DistanceBasedScoreFunction
- besskge.scoring.InterHT
@@ -173,6 +174,7 @@
- besskge.embedding.init_KGE_normal
- besskge.embedding.init_KGE_uniform
- besskge.embedding.init_uniform_norm
+- besskge.embedding.init_xavier_norm
- besskge.embedding.initialize_entity_embedding
- besskge.embedding.initialize_relation_embedding
- besskge.embedding.refactor_embedding_sharding
diff --git a/objects.inv b/objects.inv
index e2a7e026880651506671ff17a2b97abc351cfdfa..a7331e8303b0bdac563983ce566265eaf67b3b9d 100644
GIT binary patch
delta 4963
zcmV-p6P)awCax!tcz?-~+c*-v>nj*xAG#yVns(1=I-(C=s=FO_O}I-nbE+5yBtjBh
z6v-i}TITBq02gt=k_muvU%ZIO_g;cvk|Lj&8(LKldm0okzZ~=Ul+xg*Ajx9-e08Xg
z>8s|m@O2QbHqFSZ4XL+>s3ONArR6AYPcvGQn#O;Vj)fs!-G7oS&X4N@DPtPH=bP4N
zu5C)HDtK$8Qi3!hEZDF1w2op@lQbuBn>eixdHh#UGuj>BQB^Y{s>_7^Ref(YPkH&k
z<|fIKI@)CyQj_eH*mdzLFl@P=v$XO)ksUw-%R0YpKO?x%y#rS)_|7uv(g)
zlsGI%PYN8CA%9E(``dK!!2VWWGw_Y?(saGeOIp3ZUat*Hb~awFX)