Skip to content

Commit

Permalink
CONSTANTS
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Rey committed Feb 21, 2024
1 parent 4806afb commit 215f6a8
Show file tree
Hide file tree
Showing 30 changed files with 216 additions and 81 deletions.
15 changes: 15 additions & 0 deletions docs-source/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,18 @@ filter.
norm_mallows, # The sampler
{"norm_phi": 0.4, "seed": 855, "num_candidates": num_candidates}, # The arguments for the sampler
)
Constants
---------

The constants used in the package are defined with respect to their corresponding samplers, see for
instance :py:class:`~prefsampling.core.euclidean.EuclideanSpace` or :py:class:`~prefsampling.approval.NoiseType`.
They are also all gathered in the :code:`prefsampling.CONSTANTS` enumeration.

.. code-block:: python
from prefsampling import CONSTANTS
CONSTANTS.BALL
CONSTANTS.SCHROEDER
CONSTANTS.BUNKE_SHEARER
2 changes: 1 addition & 1 deletion docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="../_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="../_static/documentation_options.js?v=e645c8fa"></script>
<script src="../_static/documentation_options.js?v=7ed07c24"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down
14 changes: 7 additions & 7 deletions docs/_modules/prefsampling/approval/noise.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="../../../_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="../../../_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="../../../_static/documentation_options.js?v=e645c8fa"></script>
<script src="../../../_static/documentation_options.js?v=7ed07c24"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down Expand Up @@ -282,7 +282,7 @@ <h1>Source code for prefsampling.approval.noise</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span>

<span class="kn">import</span> <span class="nn">math</span>
<span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">Enum</span>
<span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">StrEnum</span>

<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>

Expand All @@ -292,27 +292,27 @@ <h1>Source code for prefsampling.approval.noise</h1><div class="highlight"><pre>

<div class="viewcode-block" id="NoiseType">
<a class="viewcode-back" href="../../../reference/approval/index.html#prefsampling.approval.NoiseType">[docs]</a>
<span class="k">class</span> <span class="nc">NoiseType</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">NoiseType</span><span class="p">(</span><span class="n">StrEnum</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constants representing the different types of noise that can be applied to the noise sampler.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">HAMMING</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">HAMMING</span> <span class="o">=</span> <span class="s2">&quot;Hamming noise&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Hamming noise.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">JACCARD</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">JACCARD</span> <span class="o">=</span> <span class="s2">&quot;Jaccard noise&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Jaccard noise.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">ZELINKA</span> <span class="o">=</span> <span class="mi">3</span>
<span class="n">ZELINKA</span> <span class="o">=</span> <span class="s2">&quot;Zelinka noise&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Zelinka noise.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">BUNKE_SHEARER</span> <span class="o">=</span> <span class="mi">4</span>
<span class="n">BUNKE_SHEARER</span> <span class="o">=</span> <span class="s2">&quot;Bunke-Shearer noise&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Bunke-Shearer noise.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
Expand Down
18 changes: 9 additions & 9 deletions docs/_modules/prefsampling/core/euclidean.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="../../../_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="../../../_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="../../../_static/documentation_options.js?v=e645c8fa"></script>
<script src="../../../_static/documentation_options.js?v=7ed07c24"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down Expand Up @@ -281,7 +281,7 @@ <h1></h1>
<h1>Source code for prefsampling.core.euclidean</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span>

<span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">Enum</span>
<span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">StrEnum</span>

<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>

Expand All @@ -290,26 +290,26 @@ <h1>Source code for prefsampling.core.euclidean</h1><div class="highlight"><pre>

<div class="viewcode-block" id="EuclideanSpace">
<a class="viewcode-back" href="../../../reference/core/index.html#prefsampling.core.euclidean.EuclideanSpace">[docs]</a>
<span class="k">class</span> <span class="nc">EuclideanSpace</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">EuclideanSpace</span><span class="p">(</span><span class="n">StrEnum</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constants used to represent Euclidean spaces</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">UNIFORM</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">UNIFORM</span> <span class="o">=</span> <span class="s2">&quot;Uniform Space&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Uniform space</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">GAUSSIAN</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">GAUSSIAN</span> <span class="o">=</span> <span class="s2">&quot;Gaussian Space&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Gaussian space</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">SPHERE</span> <span class="o">=</span> <span class="mi">3</span>
<span class="n">SPHERE</span> <span class="o">=</span> <span class="s2">&quot;Spherical Space&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Spheric space</span>
<span class="sd"> Spherical space</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">BALL</span> <span class="o">=</span> <span class="mi">4</span>
<span class="n">BALL</span> <span class="o">=</span> <span class="s2">&quot;Ball Space&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Ball space</span>
<span class="sd"> Ball-shaped space</span>
<span class="sd"> &quot;&quot;&quot;</span></div>


Expand Down
17 changes: 8 additions & 9 deletions docs/_modules/prefsampling/ordinal/groupseparable.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="../../../_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="../../../_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="../../../_static/documentation_options.js?v=e645c8fa"></script>
<script src="../../../_static/documentation_options.js?v=7ed07c24"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down Expand Up @@ -281,8 +281,7 @@ <h1></h1>
<h1>Source code for prefsampling.ordinal.groupseparable</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span>

<span class="kn">import</span> <span class="nn">math</span>
<span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">Enum</span>
<span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">StrEnum</span>
<span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">chain</span>

<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
Expand All @@ -300,33 +299,33 @@ <h1>Source code for prefsampling.ordinal.groupseparable</h1><div class="highligh

<div class="viewcode-block" id="TreeSampler">
<a class="viewcode-back" href="../../../reference/ordinal/index.html#prefsampling.ordinal.TreeSampler">[docs]</a>
<span class="k">class</span> <span class="nc">TreeSampler</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">TreeSampler</span><span class="p">(</span><span class="n">StrEnum</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Constants use to represent different samplers for trees that can be used for group separable</span>
<span class="sd"> preferences.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">SCHROEDER</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">SCHROEDER</span> <span class="o">=</span> <span class="s2">&quot;Scröder Tree by Alsonso, Rémy, Schott&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Random Schröder trees sampled following Alonso, Rémy, Schott (1997)</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">SCHROEDER_UNIFORM</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">SCHROEDER_UNIFORM</span> <span class="o">=</span> <span class="s2">&quot;Scröder Tree by brute-force&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Random Schröder sampled uniformly via complete enumeration algorithm</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">SCHROEDER_LESCANNE</span> <span class="o">=</span> <span class="mi">3</span>
<span class="n">SCHROEDER_LESCANNE</span> <span class="o">=</span> <span class="s2">&quot;Scröder Tree by Lescanne&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Random Schröder trees sampled following Lescanne (2022)</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">CATERPILLAR</span> <span class="o">=</span> <span class="mi">4</span>
<span class="n">CATERPILLAR</span> <span class="o">=</span> <span class="s2">&quot;Caterpillar Tree&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Caterpillar trees</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">BALANCED</span> <span class="o">=</span> <span class="mi">5</span>
<span class="n">BALANCED</span> <span class="o">=</span> <span class="s2">&quot;Balanced Tree&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Balanced trees</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
Expand Down
15 changes: 15 additions & 0 deletions docs/_sources/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,18 @@ filter.
norm_mallows, # The sampler
{"norm_phi": 0.4, "seed": 855, "num_candidates": num_candidates}, # The arguments for the sampler
)
Constants
---------

The constants used in the package are defined with respect to their corresponding samplers, see for
instance :py:class:`~prefsampling.core.euclidean.EuclideanSpace` or :py:class:`~prefsampling.approval.NoiseType`.
They are also all gathered in the :code:`prefsampling.CONSTANTS` enumeration.

.. code-block:: python
from prefsampling import CONSTANTS
CONSTANTS.BALL
CONSTANTS.SCHROEDER
CONSTANTS.BUNKE_SHEARER
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const DOCUMENTATION_OPTIONS = {
VERSION: '0.0.1',
VERSION: '0.1.8',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
2 changes: 1 addition & 1 deletion docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="_static/documentation_options.js?v=e645c8fa"></script>
<script src="_static/documentation_options.js?v=7ed07c24"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="_static/documentation_options.js?v=e645c8fa"></script>
<script src="_static/documentation_options.js?v=7ed07c24"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="_static/documentation_options.js?v=e645c8fa"></script>
<script src="_static/documentation_options.js?v=7ed07c24"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="_static/documentation_options.js?v=e645c8fa"></script>
<script src="_static/documentation_options.js?v=7ed07c24"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down
17 changes: 16 additions & 1 deletion docs/quickstart.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
<script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

<script src="_static/documentation_options.js?v=e645c8fa"></script>
<script src="_static/documentation_options.js?v=7ed07c24"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
Expand Down Expand Up @@ -332,6 +332,7 @@ <h2> Contents </h2>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#approval-samplers">Approval Samplers</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#composition-of-samplers">Composition of Samplers</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#filters">Filters</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#constants">Constants</a></li>
</ul>
</nav>
</div>
Expand Down Expand Up @@ -652,6 +653,19 @@ <h2>Filters<a class="headerlink" href="#filters" title="Link to this heading">#<
</pre></div>
</div>
</section>
<section id="constants">
<h2>Constants<a class="headerlink" href="#constants" title="Link to this heading">#</a></h2>
<p>The constants used in the package are defined with respect to their corresponding samplers, see for
instance <a class="reference internal" href="reference/core/index.html#prefsampling.core.euclidean.EuclideanSpace" title="prefsampling.core.euclidean.EuclideanSpace"><code class="xref py py-class docutils literal notranslate"><span class="pre">EuclideanSpace</span></code></a> or <a class="reference internal" href="reference/approval/index.html#prefsampling.approval.NoiseType" title="prefsampling.approval.NoiseType"><code class="xref py py-class docutils literal notranslate"><span class="pre">NoiseType</span></code></a>.
They are also all gathered in the <code class="code docutils literal notranslate"><span class="pre">prefsampling.CONSTANTS</span></code> enumeration.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">prefsampling</span> <span class="kn">import</span> <span class="n">CONSTANTS</span>

<span class="n">CONSTANTS</span><span class="o">.</span><span class="n">BALL</span>
<span class="n">CONSTANTS</span><span class="o">.</span><span class="n">SCHROEDER</span>
<span class="n">CONSTANTS</span><span class="o">.</span><span class="n">BUNKE_SHEARER</span>
</pre></div>
</div>
</section>
</section>


Expand Down Expand Up @@ -706,6 +720,7 @@ <h2>Filters<a class="headerlink" href="#filters" title="Link to this heading">#<
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#approval-samplers">Approval Samplers</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#composition-of-samplers">Composition of Samplers</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#filters">Filters</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#constants">Constants</a></li>
</ul>
</nav></div>

Expand Down
Loading

0 comments on commit 215f6a8

Please sign in to comment.