You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -847,10 +847,9 @@ <h2>MDE<a class="headerlink" href="#mde" title="Permalink to this headline">¶</
847
847
<dlclass="field-list simple">
848
848
<dtclass="field-odd">Parameters</dt>
849
849
<ddclass="field-odd"><ulclass="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><aclass="reference internal" href="#pymde.Graph" title="pymde.Graph"><em>pymde.Graph</em></a>) – The original data, a data matrix of shape <codeclass="docutils literal notranslate"><spanclass="pre">(n_items,</span><spanclass="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>
854
853
<li><p><strong>embedding_dim</strong> (<em>int</em>) – The embedding dimension. Use 2 or 3 for visualization.</p></li>
855
854
<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
856
855
weights. Typically one of the classes from <codeclass="docutils literal notranslate"><spanclass="pre">pymde.penalties</span></code>,
@@ -926,8 +925,8 @@ <h2>MDE<a class="headerlink" href="#mde" title="Permalink to this headline">¶</
926
925
<dlclass="field-list simple">
927
926
<dtclass="field-odd">Parameters</dt>
928
927
<ddclass="field-odd"><ulclass="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 <codeclass="docutils literal notranslate"><spanclass="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><aclass="reference internal" href="#pymde.Graph" title="pymde.Graph"><em>pymde.Graph</em></a>) – The original data, a data matrix of shape<codeclass="docutils literal notranslate"><spanclass="pre">(n_items,</span><spanclass="pre">n_features)</span></code> or
929
+
a graph.</p></li>
931
930
<li><p><strong>embedding_dim</strong> (<em>int</em>) – The embedding dimension.</p></li>
932
931
<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
933
932
original distances. Typically one of the classes defined in
@@ -1550,8 +1549,8 @@ <h2>Preprocessing<a class="headerlink" href="#preprocessing" title="Permalink to
1550
1549
<divclass="section" id="classical-embeddings">
1551
1550
<h2>Classical embeddings<aclass="headerlink" href="#classical-embeddings" title="Permalink to this headline">¶</a></h2>
1552
1551
<dlclass="py function">
1553
-
<dtid="pymde.quadratic.pca">
1554
-
<codeclass="sig-prename descclassname">pymde.quadratic.</code><codeclass="sig-name descname">pca</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">Y</span></em>, <emclass="sig-param"><spanclass="n">embedding_dim</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#pymde.quadratic.pca" title="Permalink to this definition">¶</a></dt>
1552
+
<dtid="pymde.pca">
1553
+
<codeclass="sig-prename descclassname">pymde.</code><codeclass="sig-name descname">pca</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">Y</span></em>, <emclass="sig-param"><spanclass="n">embedding_dim</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#pymde.pca" title="Permalink to this definition">¶</a></dt>
1555
1554
<dd><p>PCA embedding of a data matrix.</p>
1556
1555
<dlclass="field-list simple">
1557
1556
<dtclass="field-odd">Parameters</dt>
@@ -1570,6 +1569,39 @@ <h2>Classical embeddings<a class="headerlink" href="#classical-embeddings" title
1570
1569
</dl>
1571
1570
</dd></dl>
1572
1571
1572
+
<dlclass="py function">
1573
+
<dtid="pymde.laplacian_embedding">
1574
+
<codeclass="sig-prename descclassname">pymde.</code><codeclass="sig-name descname">laplacian_embedding</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">data</span></em>, <emclass="sig-param"><spanclass="n">embedding_dim</span><spanclass="o">=</span><spanclass="default_value">2</span></em>, <emclass="sig-param"><spanclass="n">n_neighbors</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">max_distance</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">init</span><spanclass="o">=</span><spanclass="default_value">'quadratic'</span></em>, <emclass="sig-param"><spanclass="n">device</span><spanclass="o">=</span><spanclass="default_value">'cpu'</span></em>, <emclass="sig-param"><spanclass="n">verbose</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span> → pymde.problem.MDE<aclass="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
+
<dlclass="field-list simple">
1579
+
<dtclass="field-odd">Parameters</dt>
1580
+
<ddclass="field-odd"><ulclass="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><aclass="reference internal" href="#pymde.Graph" title="pymde.Graph"><em>pymde.Graph</em></a>) – The original data, a data matrix of shape <codeclass="docutils literal notranslate"><spanclass="pre">(n_items,</span><spanclass="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
+
<codeclass="docutils literal notranslate"><spanclass="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 <codeclass="docutils literal notranslate"><spanclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>, print verbose output.</p></li>
1594
+
</ul>
1595
+
</dd>
1596
+
<dtclass="field-even">Returns</dt>
1597
+
<ddclass="field-even"><p>A <codeclass="docutils literal notranslate"><spanclass="pre">pymde.MDE</span></code> object, based on the original data.</p>
0 commit comments