Skip to content

Commit f266987

Browse files
committed
version to 0.1.8, rebuild docs
1 parent 78de98c commit f266987

File tree

27 files changed

+155
-109
lines changed

27 files changed

+155
-109
lines changed

docs/.buildinfo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 7153fc90f708b5e59666a299be10a5cb
3+
config: da69227389dc6b0a77a3fbb00fff02eb
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/_sources/api/index.rst.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ Preprocessing
144144
Classical embeddings
145145
--------------------
146146

147-
.. autofunction:: pymde.quadratic.pca
147+
.. autofunction:: pymde.pca
148+
149+
.. autofunction:: pymde.laplacian_embedding
148150

149151
.. autofunction:: pymde.quadratic.spectral
150152

docs/_sources/examples/index.rst.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Examples
44
========
55

6-
As with most software, after reading the documentation, the best way
7-
to learn more is by playing with code.
6+
After reading the documentation, the best way
7+
to learn more is by playing with code examples.
88

99
Our Python notebooks show how to use PyMDE on real (and synthetic)
1010
datasets. You can read these notebooks, or better yet, execute them and
@@ -109,8 +109,8 @@ introduces the ``pymde.Graph`` class.
109109

110110
- `Drawing graphs notebook <https://github.com/cvxgrp/pymde/blob/main/examples/drawing_graphs.ipynb>`_
111111

112-
Anchor Constraint
113-
-----------------
112+
Anchor Constraints
113+
------------------
114114
With an anchor constraint, you can pin some embedding vectors to values
115115
that you specify ahead of time. This is useful when you have prior
116116
knowledge of where some of the items should end up (e.g., you might
@@ -120,4 +120,4 @@ some nodes pinned in place).
120120
This notebook gives an example of how to use an anchor constraint, using
121121
graph drawing as an example.
122122

123-
- `Anchor constraints <https://github.com/cvxgrp/pymde/blob/main/examples/anchor_constraints.ipynb>`_
123+
- `Anchor constraint notebook <https://github.com/cvxgrp/pymde/blob/main/examples/anchor_constraints.ipynb>`_

docs/_sources/getting_started/index.rst.txt

+13-13
Original file line numberDiff line numberDiff line change
@@ -265,29 +265,29 @@ Classical embeddings
265265
--------------------
266266

267267
PyMDE provides a few implementations of classical embeddings, for convenience.
268-
To produce a PCA embedding of a data matrix, call the :any:`pymde.quadratic.pca`
269-
method:
268+
To produce a PCA embedding of a data matrix, use the :any:`pymde.pca`
269+
method, which returns an embedding:
270270

271271
.. code:: python3
272272
273-
embedding = pymde.quadratic.pca(data_matrix, embedding_dim)
273+
embedding = pymde.pca(data_matrix, embedding_dim)
274274
275-
To create a spectral embedding based on a sequence of edges (a ``torch.Tensor``
276-
of shape ``(n_edges, 2)``) and weights, use :any:`pymde.quadratic.spectral`.
277-
A Laplacian embedding based on the nearest neighbors of each row in a data
278-
matrix can be created with
275+
To create a Laplacian embedding based on the nearest neighbors of each row in a
276+
data matrix or each node in a graph, use the :any:`pymde.laplacian_embedding`
277+
method, which returns an MDE problem:
279278

280279
.. code:: python3
281280
282-
embedding = pymde.preserve_neighbors(data_matrix,
283-
attractive_penalty=pymde.penalties.Quadratic,
284-
repulsive_penalty=None
285-
).embed()
281+
mde = pymde.laplacian_embedding(data, embedding_dim, verbose=True)
282+
embedding = mde.embed()
286283
284+
To create a spectral embedding based on a sequence of edges (a ``torch.Tensor``
285+
of shape ``(n_edges, 2)``) and weights, use :any:`pymde.quadratic.spectral`.
286+
(These embeddings are called "quadratic embeddings" in the MDE monograph.)
287287

288288
Drawing graphs
289289
--------------
290-
Finally, PyMDE can be used to draw graphs in 2 or 3 dimensions.
290+
PyMDE can be used to draw graphs in 2 or 3 dimensions.
291291
Here is a very simple example that draws a cycle graph on 3 nodes.
292292

293293
.. code:: python3
@@ -302,7 +302,7 @@ Here is a very simple example that draws a cycle graph on 3 nodes.
302302
303303
.. image:: /files/triangle.png
304304

305-
Here is a more interesting example, in which we embed a ternary tree. The
305+
Here is a more interesting example, which embeds a ternary tree. The
306306
tree is created using the `NetworkX <https://networkx.org/>`_ package.
307307

308308
.. code:: python3

docs/_static/css/custom.css

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ h1, h2, h3, h4, h5, h6 {
1717
font-weight: 400;
1818
}
1919

20+
h2, h3, h4, h5, h6 {
21+
padding-top: 0.25em;
22+
margin-bottom: 0.5em;
23+
}
24+
2025
h1 {
2126
font-size: 225%;
2227
}

docs/_static/documentation_options.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var DOCUMENTATION_OPTIONS = {
22
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
3-
VERSION: '0.1.7',
3+
VERSION: '0.1.8',
44
LANGUAGE: 'None',
55
COLLAPSE_INDEX: false,
66
BUILDER: 'html',

docs/api/index.html

+42-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99

10-
<title>API documentation &mdash; pymde 0.1.7 documentation</title>
10+
<title>API documentation &mdash; pymde 0.1.8 documentation</title>
1111

1212

1313

@@ -66,7 +66,7 @@
6666

6767

6868
<div class="version">
69-
v0.1.7
69+
v0.1.8
7070
</div>
7171

7272

@@ -847,10 +847,9 @@ <h2>MDE<a class="headerlink" href="#mde" title="Permalink to this headline">¶</
847847
<dl class="field-list simple">
848848
<dt class="field-odd">Parameters</dt>
849849
<dd class="field-odd"><ul class="simple">
850-
<li><p><strong>data</strong> (<em>{torch.Tensor</em><em>, </em><em>numpy.ndarray</em><em>, </em><em>scipy.sparse matrix}</em><em>(</em>) – shape=(n_items, n_features)) or pymde.Graph
851-
The original data, a data matrix or a graph. Neighbors are
852-
computed using Euclidean distance if the data is a matrix,
853-
or the shortest-path metric if the data is a graph.</p></li>
850+
<li><p><strong>data</strong> (<em>{torch.Tensor</em><em>, </em><em>numpy.ndarray</em><em>, </em><em>scipy.sparse matrix}</em><em> or </em><a class="reference internal" href="#pymde.Graph" title="pymde.Graph"><em>pymde.Graph</em></a>) – The original data, a data matrix of shape <code class="docutils literal notranslate"><span class="pre">(n_items,</span> <span class="pre">n_features)</span></code> or
851+
a graph. Neighbors are computed using Euclidean distance if the data is
852+
a matrix, or the shortest-path metric if the data is a graph.</p></li>
854853
<li><p><strong>embedding_dim</strong> (<em>int</em>) – The embedding dimension. Use 2 or 3 for visualization.</p></li>
855854
<li><p><strong>attractive_penalty</strong> (<em>pymde.Function class</em><em> (or </em><em>factory</em><em>)</em>) – Callable that constructs a distortion function, given positive
856855
weights. Typically one of the classes from <code class="docutils literal notranslate"><span class="pre">pymde.penalties</span></code>,
@@ -926,8 +925,8 @@ <h2>MDE<a class="headerlink" href="#mde" title="Permalink to this headline">¶</
926925
<dl class="field-list simple">
927926
<dt class="field-odd">Parameters</dt>
928927
<dd class="field-odd"><ul class="simple">
929-
<li><p><strong>data</strong> (<em>{np.ndarray</em><em>, </em><em>torch.Tensor</em><em>, </em><em>scipy.sparse matrix}</em><em>(</em>) – shape=(n_items, n_features)), or pymde.Graph
930-
A data matrix or a <code class="docutils literal notranslate"><span class="pre">pymde.Graph</span></code> instance.</p></li>
928+
<li><p><strong>data</strong> (<em>{np.ndarray</em><em>, </em><em>torch.Tensor</em><em>, </em><em>scipy.sparse matrix}</em><em> or </em><a class="reference internal" href="#pymde.Graph" title="pymde.Graph"><em>pymde.Graph</em></a>) – The original data, a data matrix of shape <code class="docutils literal notranslate"><span class="pre">(n_items,</span> <span class="pre">n_features)</span></code> or
929+
a graph.</p></li>
931930
<li><p><strong>embedding_dim</strong> (<em>int</em>) – The embedding dimension.</p></li>
932931
<li><p><strong>loss</strong> (<em>pymde.Function class</em><em> (or </em><em>factory</em><em>)</em>) – Callable that constructs a distortion function, given
933932
original distances. Typically one of the classes defined in
@@ -1550,8 +1549,8 @@ <h2>Preprocessing<a class="headerlink" href="#preprocessing" title="Permalink to
15501549
<div class="section" id="classical-embeddings">
15511550
<h2>Classical embeddings<a class="headerlink" href="#classical-embeddings" title="Permalink to this headline"></a></h2>
15521551
<dl class="py function">
1553-
<dt id="pymde.quadratic.pca">
1554-
<code class="sig-prename descclassname">pymde.quadratic.</code><code class="sig-name descname">pca</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">Y</span></em>, <em class="sig-param"><span class="n">embedding_dim</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pymde.quadratic.pca" title="Permalink to this definition"></a></dt>
1552+
<dt id="pymde.pca">
1553+
<code class="sig-prename descclassname">pymde.</code><code class="sig-name descname">pca</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">Y</span></em>, <em class="sig-param"><span class="n">embedding_dim</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pymde.pca" title="Permalink to this definition"></a></dt>
15551554
<dd><p>PCA embedding of a data matrix.</p>
15561555
<dl class="field-list simple">
15571556
<dt class="field-odd">Parameters</dt>
@@ -1570,6 +1569,39 @@ <h2>Classical embeddings<a class="headerlink" href="#classical-embeddings" title
15701569
</dl>
15711570
</dd></dl>
15721571

1572+
<dl class="py function">
1573+
<dt id="pymde.laplacian_embedding">
1574+
<code class="sig-prename descclassname">pymde.</code><code class="sig-name descname">laplacian_embedding</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data</span></em>, <em class="sig-param"><span class="n">embedding_dim</span><span class="o">=</span><span class="default_value">2</span></em>, <em class="sig-param"><span class="n">n_neighbors</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">max_distance</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">init</span><span class="o">=</span><span class="default_value">'quadratic'</span></em>, <em class="sig-param"><span class="n">device</span><span class="o">=</span><span class="default_value">'cpu'</span></em>, <em class="sig-param"><span class="n">verbose</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span> &#x2192; pymde.problem.MDE<a class="headerlink" href="#pymde.laplacian_embedding" title="Permalink to this definition"></a></dt>
1575+
<dd><p>Constructs an MDE problem for computing a Laplacian embedding.</p>
1576+
<p>The embedding preserves the nearest neighbors of each item, using
1577+
quadratic distortion functions and a standardization constraint.</p>
1578+
<dl class="field-list simple">
1579+
<dt class="field-odd">Parameters</dt>
1580+
<dd class="field-odd"><ul class="simple">
1581+
<li><p><strong>data</strong> (<em>{torch.Tensor</em><em>, </em><em>numpy.ndarray</em><em>, </em><em>scipy.sparse matrix}</em><em> or </em><a class="reference internal" href="#pymde.Graph" title="pymde.Graph"><em>pymde.Graph</em></a>) – The original data, a data matrix of shape <code class="docutils literal notranslate"><span class="pre">(n_items,</span> <span class="pre">n_features)</span></code> or
1582+
a graph. Neighbors are computed using Euclidean distance if the data is
1583+
a matrix, or the shortest-path metric if the data is a graph.</p></li>
1584+
<li><p><strong>embedding_dim</strong> (<em>int</em>) – The embedding dimension. Use 2 or 3 for visualization.</p></li>
1585+
<li><p><strong>n_neighbors</strong> (<em>int</em><em> (</em><em>optional</em><em>)</em>) – The number of nearest neighbors to compute for each row (item) of
1586+
<code class="docutils literal notranslate"><span class="pre">data</span></code>. A sensible value is chosen by default, depending on the
1587+
number of items.</p></li>
1588+
<li><p><strong>max_distance</strong> (<em>float</em><em> (</em><em>optional</em><em>)</em>) – If not None, neighborhoods are restricted to have a radius
1589+
no greater than <code class="docutils literal notranslate"><span class="pre">max_distance</span></code>.</p></li>
1590+
<li><p><strong>init</strong> (<em>str</em>) – Initialization strategy; ‘quadratic’ or ‘random’. If the quadratic
1591+
initialization takes too much time, try a random initialization.</p></li>
1592+
<li><p><strong>device</strong> (<em>str</em><em> (</em><em>optional</em><em>)</em>) – Device for the embedding (eg, ‘cpu’, ‘cuda’).</p></li>
1593+
<li><p><strong>verbose</strong> (<em>bool</em>) – If <code class="docutils literal notranslate"><span class="pre">True</span></code>, print verbose output.</p></li>
1594+
</ul>
1595+
</dd>
1596+
<dt class="field-even">Returns</dt>
1597+
<dd class="field-even"><p>A <code class="docutils literal notranslate"><span class="pre">pymde.MDE</span></code> object, based on the original data.</p>
1598+
</dd>
1599+
<dt class="field-odd">Return type</dt>
1600+
<dd class="field-odd"><p><a class="reference internal" href="#pymde.MDE" title="pymde.MDE">pymde.MDE</a></p>
1601+
</dd>
1602+
</dl>
1603+
</dd></dl>
1604+
15731605
<dl class="py function">
15741606
<dt id="pymde.quadratic.spectral">
15751607
<code class="sig-prename descclassname">pymde.quadratic.</code><code class="sig-name descname">spectral</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">n_items</span></em>, <em class="sig-param"><span class="n">embedding_dim</span></em>, <em class="sig-param"><span class="n">edges</span></em>, <em class="sig-param"><span class="n">weights</span></em>, <em class="sig-param"><span class="n">cg</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">max_iter</span><span class="o">=</span><span class="default_value">40</span></em>, <em class="sig-param"><span class="n">device</span><span class="o">=</span><span class="default_value">'cpu'</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pymde.quadratic.spectral" title="Permalink to this definition"></a></dt>

docs/citing/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99

10-
<title>Citing &mdash; pymde 0.1.7 documentation</title>
10+
<title>Citing &mdash; pymde 0.1.8 documentation</title>
1111

1212

1313

@@ -65,7 +65,7 @@
6565

6666

6767
<div class="version">
68-
v0.1.7
68+
v0.1.8
6969
</div>
7070

7171

docs/datasets/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99

10-
<title>Datasets &mdash; pymde 0.1.7 documentation</title>
10+
<title>Datasets &mdash; pymde 0.1.8 documentation</title>
1111

1212

1313

@@ -66,7 +66,7 @@
6666

6767

6868
<div class="version">
69-
v0.1.7
69+
v0.1.8
7070
</div>
7171

7272

docs/examples/index.html

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99

10-
<title>Examples &mdash; pymde 0.1.7 documentation</title>
10+
<title>Examples &mdash; pymde 0.1.8 documentation</title>
1111

1212

1313

@@ -66,7 +66,7 @@
6666

6767

6868
<div class="version">
69-
v0.1.7
69+
v0.1.8
7070
</div>
7171

7272

@@ -107,7 +107,7 @@
107107
<li class="toctree-l2"><a class="reference internal" href="#us-counties">US Counties</a></li>
108108
<li class="toctree-l2"><a class="reference internal" href="#dissimilar-edges-and-negative-weights">Dissimilar Edges and Negative Weights</a></li>
109109
<li class="toctree-l2"><a class="reference internal" href="#drawing-graphs">Drawing Graphs</a></li>
110-
<li class="toctree-l2"><a class="reference internal" href="#anchor-constraint">Anchor Constraint</a></li>
110+
<li class="toctree-l2"><a class="reference internal" href="#anchor-constraints">Anchor Constraints</a></li>
111111
</ul>
112112
</li>
113113
<li class="toctree-l1"><a class="reference internal" href="../api/index.html">API documentation</a></li>
@@ -184,8 +184,8 @@
184184

185185
<div class="section" id="examples">
186186
<span id="id1"></span><h1>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h1>
187-
<p>As with most software, after reading the documentation, the best way
188-
to learn more is by playing with code.</p>
187+
<p>After reading the documentation, the best way
188+
to learn more is by playing with code examples.</p>
189189
<p>Our Python notebooks show how to use PyMDE on real (and synthetic)
190190
datasets. You can read these notebooks, or better yet, execute them and
191191
experiment by modifying the cells’ contents and seeing what happens.</p>
@@ -279,8 +279,8 @@ <h2>Dissimilar Edges and Negative Weights<a class="headerlink" href="#dissimilar
279279
<li><p><a class="reference external" href="https://github.com/cvxgrp/pymde/blob/main/examples/drawing_graphs.ipynb">Drawing graphs notebook</a></p></li>
280280
</ul>
281281
</div>
282-
<div class="section" id="anchor-constraint">
283-
<h2>Anchor Constraint<a class="headerlink" href="#anchor-constraint" title="Permalink to this headline"></a></h2>
282+
<div class="section" id="anchor-constraints">
283+
<h2>Anchor Constraints<a class="headerlink" href="#anchor-constraints" title="Permalink to this headline"></a></h2>
284284
<p>With an anchor constraint, you can pin some embedding vectors to values
285285
that you specify ahead of time. This is useful when you have prior
286286
knowledge of where some of the items should end up (e.g., you might
@@ -289,7 +289,7 @@ <h2>Anchor Constraint<a class="headerlink" href="#anchor-constraint" title="Perm
289289
<p>This notebook gives an example of how to use an anchor constraint, using
290290
graph drawing as an example.</p>
291291
<ul class="simple">
292-
<li><p><a class="reference external" href="https://github.com/cvxgrp/pymde/blob/main/examples/anchor_constraints.ipynb">Anchor constraints</a></p></li>
292+
<li><p><a class="reference external" href="https://github.com/cvxgrp/pymde/blob/main/examples/anchor_constraints.ipynb">Anchor constraint notebook</a></p></li>
293293
</ul>
294294
</div>
295295
</div>

docs/genindex.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99

10-
<title>Index &mdash; pymde 0.1.7 documentation</title>
10+
<title>Index &mdash; pymde 0.1.8 documentation</title>
1111

1212

1313

@@ -64,7 +64,7 @@
6464

6565

6666
<div class="version">
67-
v0.1.7
67+
v0.1.8
6868
</div>
6969

7070

@@ -359,6 +359,8 @@ <h2 id="K">K</h2>
359359
<h2 id="L">L</h2>
360360
<table style="width: 100%" class="indextable genindextable"><tr>
361361
<td style="width: 33%; vertical-align: top;"><ul>
362+
<li><a href="api/index.html#pymde.laplacian_embedding">laplacian_embedding() (in module pymde)</a>
363+
</li>
362364
<li><a href="api/index.html#pymde.penalties.Linear">Linear (class in pymde.penalties)</a>
363365
</li>
364366
<li><a href="api/index.html#pymde.penalties.Log">Log (class in pymde.penalties)</a>
@@ -420,7 +422,7 @@ <h2 id="N">N</h2>
420422
<h2 id="P">P</h2>
421423
<table style="width: 100%" class="indextable genindextable"><tr>
422424
<td style="width: 33%; vertical-align: top;"><ul>
423-
<li><a href="api/index.html#pymde.quadratic.pca">pca() (in module pymde.quadratic)</a>
425+
<li><a href="api/index.html#pymde.pca">pca() (in module pymde)</a>
424426
</li>
425427
<li><a href="api/index.html#pymde.MDE.play">play() (pymde.MDE method)</a>
426428
</li>

0 commit comments

Comments
 (0)