Skip to content

Commit

Permalink
AlCatt91 published a site update
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCatt91 committed Nov 8, 2023
1 parent 6c91ca5 commit 96339f1
Show file tree
Hide file tree
Showing 33 changed files with 872 additions and 52 deletions.
18 changes: 18 additions & 0 deletions _modules/besskge/embedding.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ <h1>Source code for besskge.embedding</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">torch</span><span class="o">.</span><span class="n">nn</span><span class="o">.</span><span class="n">functional</span><span class="o">.</span><span class="n">normalize</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">nn</span><span class="o">.</span><span class="n">init</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">embedding_table</span><span class="p">),</span> <span class="n">dim</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span></div>


<div class="viewcode-block" id="init_xavier_norm"><a class="viewcode-back" href="../../generated/besskge.embedding.init_xavier_norm.html#besskge.embedding.init_xavier_norm">[docs]</a><span class="k">def</span> <span class="nf">init_xavier_norm</span><span class="p">(</span><span class="n">embedding_table</span><span class="p">:</span> <span class="n">torch</span><span class="o">.</span><span class="n">Tensor</span><span class="p">,</span> <span class="n">gain</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">torch</span><span class="o">.</span><span class="n">Tensor</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Initialize embeddings according to Xavier normal scheme, with</span>
<span class="sd"> `fan_in = 0`, `fan_out=row_size`.</span>

<span class="sd"> :param embedding_table:</span>
<span class="sd"> Tensor of embedding parameters to initialize.</span>
<span class="sd"> :param gain:</span>
<span class="sd"> Scaling factor for standard deviation. Default: 1.0.</span>

<span class="sd"> :return:</span>
<span class="sd"> Initialized tensor.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">torch</span><span class="o">.</span><span class="n">nn</span><span class="o">.</span><span class="n">init</span><span class="o">.</span><span class="n">normal_</span><span class="p">(</span>
<span class="n">embedding_table</span><span class="p">,</span> <span class="n">std</span><span class="o">=</span><span class="n">gain</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="mf">2.0</span> <span class="o">/</span> <span class="n">embedding_table</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
<span class="p">)</span></div>


<div class="viewcode-block" id="init_KGE_uniform"><a class="viewcode-back" href="../../generated/besskge.embedding.init_KGE_uniform.html#besskge.embedding.init_KGE_uniform">[docs]</a><span class="k">def</span> <span class="nf">init_KGE_uniform</span><span class="p">(</span>
<span class="n">embedding_table</span><span class="p">:</span> <span class="n">torch</span><span class="o">.</span><span class="n">Tensor</span><span class="p">,</span> <span class="n">b</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span> <span class="n">divide_by_embedding_size</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">torch</span><span class="o">.</span><span class="n">Tensor</span><span class="p">:</span>
Expand Down
219 changes: 210 additions & 9 deletions _modules/besskge/scoring.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions _sources/generated/besskge.embedding.init_xavier_norm.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
besskge.embedding.init\_xavier\_norm
====================================

.. currentmodule:: besskge.embedding

.. autofunction:: init_xavier_norm
1 change: 1 addition & 0 deletions _sources/generated/besskge.embedding.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions _sources/generated/besskge.scoring.ConvE.rst.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions _sources/generated/besskge.scoring.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ besskge.scoring
BaseScoreFunction
BoxE
ComplEx
ConvE
DistMult
DistanceBasedScoreFunction
InterHT
Expand Down
4 changes: 2 additions & 2 deletions generated/besskge.dataset.KGDataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ <h1>besskge.dataset.KGDataset<a class="headerlink" href="#besskge-dataset-kgdata
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>df</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="http://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.DataFrame.html#pandas.DataFrame" title="(in pandas v2.2.0.dev0+502.gba4322431d)"><code class="xref py py-class docutils literal notranslate"><span class="pre">DataFrame</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="http://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.DataFrame.html#pandas.DataFrame" title="(in pandas v2.2.0.dev0+502.gba4322431d)"><code class="xref py py-class docutils literal notranslate"><span class="pre">DataFrame</span></code></a>]]) – Pandas DataFrame of all triples in the knowledge graph dataset,
<li><p><strong>df</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="http://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.DataFrame.html#pandas.DataFrame" title="(in pandas v2.2.0.dev0+541.g51f3d03087)"><code class="xref py py-class docutils literal notranslate"><span class="pre">DataFrame</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="http://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.DataFrame.html#pandas.DataFrame" title="(in pandas v2.2.0.dev0+541.g51f3d03087)"><code class="xref py py-class docutils literal notranslate"><span class="pre">DataFrame</span></code></a>]]) – Pandas DataFrame of all triples in the knowledge graph dataset,
or dictionary of DataFrames of triples for each part of the dataset split</p></li>
<li><p><strong>head_column</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Name of the DataFrame column storing head entities</p></li>
<li><p><strong>relation_column</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Name of the DataFrame column storing relations</p></li>
<li><p><strong>tail_column</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Name of the DataFrame column storing tail entities</p></li>
<li><p><strong>entity_types</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="http://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.Series.html#pandas.Series" title="(in pandas v2.2.0.dev0+502.gba4322431d)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Series</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.12)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a>]) – If entities have types, dictionary or pandas Series of mappings
<li><p><strong>entity_types</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="http://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.Series.html#pandas.Series" title="(in pandas v2.2.0.dev0+541.g51f3d03087)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Series</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.12)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a>]) – If entities have types, dictionary or pandas Series of mappings
entity label -&gt; entity type (as strings).</p></li>
<li><p><strong>split</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Tuple" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – Tuple to set the train/validation/test split.
Only used if no pre-defined dataset split is specified,
Expand Down
10 changes: 7 additions & 3 deletions generated/besskge.embedding.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_KGE_normal.html">besskge.embedding.init_KGE_normal</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_KGE_uniform.html">besskge.embedding.init_KGE_uniform</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_uniform_norm.html">besskge.embedding.init_uniform_norm</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_xavier_norm.html">besskge.embedding.init_xavier_norm</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.initialize_entity_embedding.html">besskge.embedding.initialize_entity_embedding</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.initialize_relation_embedding.html">besskge.embedding.initialize_relation_embedding</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.refactor_embedding_sharding.html">besskge.embedding.refactor_embedding_sharding</a></li>
Expand Down Expand Up @@ -111,13 +112,16 @@
<tr class="row-odd"><td><p><a class="reference internal" href="besskge.embedding.init_uniform_norm.html#besskge.embedding.init_uniform_norm" title="besskge.embedding.init_uniform_norm"><code class="xref py py-obj docutils literal notranslate"><span class="pre">init_uniform_norm</span></code></a>(embedding_table)</p></td>
<td><p>Initialize embeddings according to uniform distribution and normalize so that each row has norm 1.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="besskge.embedding.initialize_entity_embedding.html#besskge.embedding.initialize_entity_embedding" title="besskge.embedding.initialize_entity_embedding"><code class="xref py py-obj docutils literal notranslate"><span class="pre">initialize_entity_embedding</span></code></a>(sharding, ...[, ...])</p></td>
<tr class="row-even"><td><p><a class="reference internal" href="besskge.embedding.init_xavier_norm.html#besskge.embedding.init_xavier_norm" title="besskge.embedding.init_xavier_norm"><code class="xref py py-obj docutils literal notranslate"><span class="pre">init_xavier_norm</span></code></a>(embedding_table[, gain])</p></td>
<td><p>Initialize embeddings according to Xavier normal scheme, with <cite>fan_in = 0</cite>, <cite>fan_out=row_size</cite>.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="besskge.embedding.initialize_entity_embedding.html#besskge.embedding.initialize_entity_embedding" title="besskge.embedding.initialize_entity_embedding"><code class="xref py py-obj docutils literal notranslate"><span class="pre">initialize_entity_embedding</span></code></a>(sharding, ...[, ...])</p></td>
<td><p>Initialize entity embedding table.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="besskge.embedding.initialize_relation_embedding.html#besskge.embedding.initialize_relation_embedding" title="besskge.embedding.initialize_relation_embedding"><code class="xref py py-obj docutils literal notranslate"><span class="pre">initialize_relation_embedding</span></code></a>(...[, row_size])</p></td>
<tr class="row-even"><td><p><a class="reference internal" href="besskge.embedding.initialize_relation_embedding.html#besskge.embedding.initialize_relation_embedding" title="besskge.embedding.initialize_relation_embedding"><code class="xref py py-obj docutils literal notranslate"><span class="pre">initialize_relation_embedding</span></code></a>(...[, row_size])</p></td>
<td><p>Initialize relation embedding table.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="besskge.embedding.refactor_embedding_sharding.html#besskge.embedding.refactor_embedding_sharding" title="besskge.embedding.refactor_embedding_sharding"><code class="xref py py-obj docutils literal notranslate"><span class="pre">refactor_embedding_sharding</span></code></a>(...)</p></td>
<tr class="row-odd"><td><p><a class="reference internal" href="besskge.embedding.refactor_embedding_sharding.html#besskge.embedding.refactor_embedding_sharding" title="besskge.embedding.refactor_embedding_sharding"><code class="xref py py-obj docutils literal notranslate"><span class="pre">refactor_embedding_sharding</span></code></a>(...)</p></td>
<td><p>Refactor sharded entity embedding table to pass from one entity sharding to a different one.</p></td>
</tr>
</tbody>
Expand Down
1 change: 1 addition & 0 deletions generated/besskge.embedding.init_KGE_normal.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
</li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_KGE_uniform.html">besskge.embedding.init_KGE_uniform</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_uniform_norm.html">besskge.embedding.init_uniform_norm</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_xavier_norm.html">besskge.embedding.init_xavier_norm</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.initialize_entity_embedding.html">besskge.embedding.initialize_entity_embedding</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.initialize_relation_embedding.html">besskge.embedding.initialize_relation_embedding</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.refactor_embedding_sharding.html">besskge.embedding.refactor_embedding_sharding</a></li>
Expand Down
1 change: 1 addition & 0 deletions generated/besskge.embedding.init_KGE_uniform.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_uniform_norm.html">besskge.embedding.init_uniform_norm</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.init_xavier_norm.html">besskge.embedding.init_xavier_norm</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.initialize_entity_embedding.html">besskge.embedding.initialize_entity_embedding</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.initialize_relation_embedding.html">besskge.embedding.initialize_relation_embedding</a></li>
<li class="toctree-l3"><a class="reference internal" href="besskge.embedding.refactor_embedding_sharding.html">besskge.embedding.refactor_embedding_sharding</a></li>
Expand Down
Loading

0 comments on commit 96339f1

Please sign in to comment.