Repository navigation
Expand file tree
/
Copy pathot.datasets.html
More file actions
531 lines (485 loc) · 55.2 KB
/
Copy pathot.datasets.html
File metadata and controls
531 lines (485 loc) · 55.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ot.datasets — POT Python Optimal Transport 0.9.7 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=9edc463e" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery.css?v=fd6457a4" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery-binder.css?v=f4aeca0c" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery-dataframe.css?v=2082cf3c" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery-rendered-html.css?v=1277b6f3" />
<script src="../_static/jquery.js?v=5d32c60e"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../_static/documentation_options.js?v=f2328ca0"></script>
<script src="../_static/doctools.js?v=fd6eb6e6"></script>
<script src="../_static/sphinx_highlight.js?v=6ffebe34"></script>
<script src="../_static/sg-tags.js?v=d80f6fa4"></script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="ot.dr" href="ot.dr.html" />
<link rel="prev" title="ot.da" href="ot.da.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home">
POT Python Optimal Transport
<img src="../_static/logo_dark.svg" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">POT: Python Optimal Transport</a></li>
<li class="toctree-l1"><a class="reference internal" href="../auto_examples/plot_quickstart_guide.html">Quickstart Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../auto_examples/index.html">Examples gallery</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide.html">User guide</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../all.html">API and modules</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="ot.backend.html">ot.backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.batch.html">ot.batch</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.bregman.html">ot.bregman</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.bsp.html">ot.bsp</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.coot.html">ot.coot</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.da.html">ot.da</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">ot.datasets</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#functions">Functions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#ot.datasets.make_1D_gauss"><code class="docutils literal notranslate"><span class="pre">make_1D_gauss()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#examples-using-ot-datasets-make-1d-gauss">Examples using <code class="docutils literal notranslate"><span class="pre">ot.datasets.make_1D_gauss</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#examples-using-ot-datasets-make-2d-samples-gauss">Examples using <code class="docutils literal notranslate"><span class="pre">ot.datasets.make_2D_samples_gauss</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#examples-using-ot-datasets-make-data-classif">Examples using <code class="docutils literal notranslate"><span class="pre">ot.datasets.make_data_classif</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id0"><code class="docutils literal notranslate"><span class="pre">make_1D_gauss()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2"><code class="docutils literal notranslate"><span class="pre">make_2D_samples_gauss()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3"><code class="docutils literal notranslate"><span class="pre">make_data_classif()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#id4"><code class="docutils literal notranslate"><span class="pre">make_gauss_hd()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="ot.dr.html">ot.dr</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.factored.html">ot.factored</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.gaussian.html">ot.gaussian</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.gmm.html">ot.gmm</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.gnn.html">ot.gnn</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.gromov.html">ot.gromov</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.lowrank.html">ot.lowrank</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.lp.html">ot.lp</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.mapping.html">ot.mapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.optim.html">ot.optim</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.partial.html">ot.partial</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.plot.html">ot.plot</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.regpath.html">ot.regpath</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.sliced.html">ot.sliced</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.sgot.html">ot.sgot</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.smooth.html">ot.smooth</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.stochastic.html">ot.stochastic</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.unbalanced.html">ot.unbalanced</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.utils.html">ot.utils</a></li>
<li class="toctree-l2"><a class="reference internal" href="ot.weak.html">ot.weak</a></li>
<li class="toctree-l2"><a class="reference internal" href="../all.html#module-ot">Main <code class="xref py py-mod docutils literal notranslate"><span class="pre">ot</span></code> functions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../releases.html">Releases</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributors.html">Contributors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing to POT</a></li>
<li class="toctree-l1"><a class="reference internal" href="../code_of_conduct.html">Code of conduct</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">POT Python Optimal Transport</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="../all.html">API and modules</a></li>
<li class="breadcrumb-item active">ot.datasets</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/gen_modules/ot.datasets.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-ot.datasets">
<span id="ot-datasets"></span><h1>ot.datasets<a class="headerlink" href="#module-ot.datasets" title="Link to this heading"></a></h1>
<p>Simple example datasets</p>
<section id="functions">
<h2>Functions<a class="headerlink" href="#functions" title="Link to this heading"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="ot.datasets.make_1D_gauss">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_1D_gauss</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">s</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_1D_gauss"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#ot.datasets.make_1D_gauss" title="Link to this definition"></a></dt>
<dd><p>return a 1D histogram for a gaussian distribution (<cite>n</cite> bins, mean <cite>m</cite> and std <cite>s</cite>)</p>
<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>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of bins in the histogram</p></li>
<li><p><strong>m</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – mean value of the gaussian distribution</p></li>
<li><p><strong>s</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – standard deviation of the gaussian distribution</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>h</strong> – 1D histogram for a gaussian distribution</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>ndarray (<cite>n</cite>,)</p>
</dd>
</dl>
</dd></dl>
<section id="examples-using-ot-datasets-make-1d-gauss">
<h3>Examples using <code class="docutils literal notranslate"><span class="pre">ot.datasets.make_1D_gauss</span></code><a class="headerlink" href="#examples-using-ot-datasets-make-1d-gauss" title="Link to this heading"></a></h3>
<div class="sphx-glr-thumbnails"><div class="sphx-glr-thumbcontainer" tooltip="Illustrates the use of the generic solver for regularized OT with user-designed regularization term. It uses Conditional gradient as in [6] and generalized Conditional Gradient as proposed in [5,7]."><img alt="" src="../_images/sphx_glr_plot_optim_OTreg_thumb.png" />
<p><a class="reference internal" href="../auto_examples/plot_optim_OTreg.html"><span class="doc">Regularized OT with generic solver</span></a></p>
<div class="sphx-glr-thumbnail-title">Regularized OT with generic solver</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of EMD and Sinkhorn transport plans and their visualization."><img alt="" src="../_images/sphx_glr_plot_OT_1D_thumb.png" />
<p><a class="reference internal" href="../auto_examples/plot_OT_1D.html"><span class="doc">Optimal Transport for fixed support</span></a></p>
<div class="sphx-glr-thumbnail-title">Optimal Transport for fixed support</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Shows how to compute multiple Wasserstein and Sinkhorn with two different ground metrics and plot their values for different distributions."><img alt="" src="../_images/sphx_glr_plot_compute_emd_thumb.png" />
<p><a class="reference internal" href="../auto_examples/plot_compute_emd.html"><span class="doc">Geometry of OT distances</span></a></p>
<div class="sphx-glr-thumbnail-title">Geometry of OT distances</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the solutions returns for different variants of exact, regularized and unbalanced OT solvers."><img alt="" src="../_images/sphx_glr_plot_solve_variants_thumb.png" />
<p><a class="reference internal" href="../auto_examples/plot_solve_variants.html"><span class="doc">Optimal Transport solvers comparison</span></a></p>
<div class="sphx-glr-thumbnail-title">Optimal Transport solvers comparison</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="In this small example, we consider the following minimization problem:"><img alt="" src="../_images/sphx_glr_plot_wass1d_torch_thumb.png" />
<p><a class="reference internal" href="../auto_examples/backends/plot_wass1d_torch.html"><span class="doc">Wasserstein 1D (flow and barycenter) with PyTorch</span></a></p>
<div class="sphx-glr-thumbnail-title">Wasserstein 1D (flow and barycenter) with PyTorch</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of regularized Wasserstein Barycenter as proposed in [3]."><img alt="" src="../_images/sphx_glr_plot_barycenter_1D_thumb.png" />
<p><a class="reference internal" href="../auto_examples/barycenters/plot_barycenter_1D.html"><span class="doc">1D Wasserstein barycenter demo</span></a></p>
<div class="sphx-glr-thumbnail-title">1D Wasserstein barycenter demo</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of the debiased Sinkhorn barycenter as proposed in [37]_."><img alt="" src="../_images/sphx_glr_plot_debiased_barycenter_thumb.png" />
<p><a class="reference internal" href="../auto_examples/barycenters/plot_debiased_barycenter.html"><span class="doc">Debiased Sinkhorn barycenter demo</span></a></p>
<div class="sphx-glr-thumbnail-title">Debiased Sinkhorn barycenter demo</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of regularized Wasserstein Barycenter as proposed in [3] and exact LP barycenters using standard LP solver."><img alt="" src="../_images/sphx_glr_plot_barycenter_lp_vs_entropic_thumb.png" />
<p><a class="reference internal" href="../auto_examples/barycenters/plot_barycenter_lp_vs_entropic.html"><span class="doc">1D Wasserstein barycenter: exact LP vs entropic regularization</span></a></p>
<div class="sphx-glr-thumbnail-title">1D Wasserstein barycenter: exact LP vs entropic regularization</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of Low Rank Sinkhorn [26]."><img alt="" src="../_images/sphx_glr_plot_lowrank_sinkhorn_thumb.png" />
<p><a class="reference internal" href="../auto_examples/lowrank/plot_lowrank_sinkhorn.html"><span class="doc">Low rank Sinkhorn</span></a></p>
<div class="sphx-glr-thumbnail-title">Low rank Sinkhorn</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="When the cost is discretized (Monge), the d-MMOT solver can more quickly compute and minimize the distance between many distributions without the need for intermediate barycenter computations. This example compares the time to identify, and the quality of, solutions for the d-MMOT problem using a primal/dual algorithm and classical LP barycenter approaches."><img alt="" src="../_images/sphx_glr_plot_dmmot_thumb.png" />
<p><a class="reference internal" href="../auto_examples/others/plot_dmmot.html"><span class="doc">Computing 1-dimensional Barycenters via d-MMOT</span></a></p>
<div class="sphx-glr-thumbnail-title">Computing 1-dimensional Barycenters via d-MMOT</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of regularized Wasserstein Barycenter as proposed in [10] for Unbalanced inputs."><img alt="" src="../_images/sphx_glr_plot_UOT_barycenter_1D_thumb.png" />
<p><a class="reference internal" href="../auto_examples/unbalanced-partial/plot_UOT_barycenter_1D.html"><span class="doc">1D Wasserstein barycenter demo for Unbalanced distributions</span></a></p>
<div class="sphx-glr-thumbnail-title">1D Wasserstein barycenter demo for Unbalanced distributions</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of Unbalanced Optimal transport using a Kullback-Leibler relaxation."><img alt="" src="../_images/sphx_glr_plot_UOT_1D_thumb.png" />
<p><a class="reference internal" href="../auto_examples/unbalanced-partial/plot_UOT_1D.html"><span class="doc">1D Unbalanced optimal transport</span></a></p>
<div class="sphx-glr-thumbnail-title">1D Unbalanced optimal transport</div>
</div></div><div class="sphx-glr-clear"></div><dl class="py function">
<dt class="sig sig-object py" id="ot.datasets.make_2D_samples_gauss">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_2D_samples_gauss</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sigma</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">random_state</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_2D_samples_gauss"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#ot.datasets.make_2D_samples_gauss" title="Link to this definition"></a></dt>
<dd><p>Return <cite>n</cite> samples drawn from 2D gaussian <span class="math notranslate nohighlight">\(\mathcal{N}(m, \sigma)\)</span></p>
<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>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of samples to make</p></li>
<li><p><strong>m</strong> (<em>ndarray</em><em>, </em><em>shape</em><em> (</em><em>2</em><em>,</em><em>)</em>) – mean value of the gaussian distribution</p></li>
<li><p><strong>sigma</strong> (<em>ndarray</em><em>, </em><em>shape</em><em> (</em><em>2</em><em>, </em><em>2</em><em>)</em>) – covariance matrix of the gaussian distribution</p></li>
<li><p><strong>random_state</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>, </em><em>RandomState instance</em><em> or </em><em>None</em><em>, </em><em>optional</em><em> (</em><em>default=None</em><em>)</em>) – If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by <cite>np.random</cite>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>X</strong> – n samples drawn from <span class="math notranslate nohighlight">\(\mathcal{N}(m, \sigma)\)</span>.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>ndarray, shape (<cite>n</cite>, 2)</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="examples-using-ot-datasets-make-2d-samples-gauss">
<h3>Examples using <code class="docutils literal notranslate"><span class="pre">ot.datasets.make_2D_samples_gauss</span></code><a class="headerlink" href="#examples-using-ot-datasets-make-2d-samples-gauss" title="Link to this heading"></a></h3>
<div class="sphx-glr-thumbnails"><div class="sphx-glr-thumbcontainer" tooltip="Illustration of optimal transport between distributions in 2D that are weighted sum of Diracs. The OT matrix is plotted with the samples."><img alt="" src="../_images/sphx_glr_plot_OT_2D_samples_thumb.png" />
<p><a class="reference internal" href="../auto_examples/plot_OT_2D_samples.html"><span class="doc">Optimal Transport between empirical distributions</span></a></p>
<div class="sphx-glr-thumbnail-title">Optimal Transport between empirical distributions</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example is designed to show how to use the Gromov-Wasserstein distance computation in POT. We first compare 3 solvers to estimate the distance based on Conditional Gradient [24] or Sinkhorn projections [12, 51]. Then we compare 2 stochastic solvers to estimate the distance with a lower numerical cost [33]."><img alt="" src="../_images/sphx_glr_plot_gromov_thumb.png" />
<p><a class="reference internal" href="../auto_examples/gromov/plot_gromov.html"><span class="doc">Gromov-Wasserstein example</span></a></p>
<div class="sphx-glr-thumbnail-title">Gromov-Wasserstein example</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Illustration of 2D optimal transport between distributions that are weighted sum of Diracs. The OT matrix is plotted with the samples."><img alt="" src="../_images/sphx_glr_plot_WeakOT_VS_OT_thumb.png" />
<p><a class="reference internal" href="../auto_examples/others/plot_WeakOT_VS_OT.html"><span class="doc">Weak Optimal Transport VS exact Optimal Transport</span></a></p>
<div class="sphx-glr-thumbnail-title">Weak Optimal Transport VS exact Optimal Transport</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of the sliced Wasserstein Distance as proposed in [31]."><img alt="" src="../_images/sphx_glr_plot_variance_thumb.png" />
<p><a class="reference internal" href="../auto_examples/sliced-wasserstein/plot_variance.html"><span class="doc">Sliced Wasserstein Distance on 2D distributions</span></a></p>
<div class="sphx-glr-thumbnail-title">Sliced Wasserstein Distance on 2D distributions</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This examples illustrates the better convergence of the translation invariance Sinkhorn algorithm proposed in [73] compared to the classical Sinkhorn algorithm."><img alt="" src="../_images/sphx_glr_plot_conv_sinkhorn_ti_thumb.png" />
<p><a class="reference internal" href="../auto_examples/unbalanced-partial/plot_conv_sinkhorn_ti.html"><span class="doc">Translation Invariant Sinkhorn for Unbalanced Optimal Transport</span></a></p>
<div class="sphx-glr-thumbnail-title">Translation Invariant Sinkhorn for Unbalanced Optimal Transport</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example is designed to show how to compute unbalanced and partial OT in POT."><img alt="" src="../_images/sphx_glr_plot_unbalanced_OT_thumb.png" />
<p><a class="reference internal" href="../auto_examples/unbalanced-partial/plot_unbalanced_OT.html"><span class="doc">2D examples of exact and entropic unbalanced optimal transport</span></a></p>
<div class="sphx-glr-thumbnail-title">2D examples of exact and entropic unbalanced optimal transport</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example is designed to show how to use the Partial (Gromov-)Wasserstein distance computation in POT [29]."><img alt="" src="../_images/sphx_glr_plot_partial_wass_and_gromov_thumb.png" />
<p><a class="reference internal" href="../auto_examples/unbalanced-partial/plot_partial_wass_and_gromov.html"><span class="doc">Partial Wasserstein and Gromov-Wasserstein example</span></a></p>
<div class="sphx-glr-thumbnail-title">Partial Wasserstein and Gromov-Wasserstein example</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrate the regularization path for 2D unbalanced optimal transport. We present here both the fully relaxed case and the semi-relaxed case."><img alt="" src="../_images/sphx_glr_plot_regpath_thumb.png" />
<p><a class="reference internal" href="../auto_examples/unbalanced-partial/plot_regpath.html"><span class="doc">Regularization path of l2-penalized unbalanced optimal transport</span></a></p>
<div class="sphx-glr-thumbnail-title">Regularization path of l2-penalized unbalanced optimal transport</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the behavior of Sliced UOT versus Unbalanced Sliced OT, introduced in [82]. The first one removes outliers on each slice while the second one removes outliers of the original marginals."><img alt="" src="../_images/sphx_glr_plot_UOT_sliced_thumb.png" />
<p><a class="reference internal" href="../auto_examples/unbalanced-partial/plot_UOT_sliced.html"><span class="doc">Sliced Unbalanced optimal transport</span></a></p>
<div class="sphx-glr-thumbnail-title">Sliced Unbalanced optimal transport</div>
</div></div><div class="sphx-glr-clear"></div><dl class="py function">
<dt class="sig sig-object py" id="ot.datasets.make_data_classif">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_data_classif</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dataset</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nz</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">theta</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">random_state</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_data_classif"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#ot.datasets.make_data_classif" title="Link to this definition"></a></dt>
<dd><p>Dataset generation for classification problems</p>
<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>dataset</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.14)"><em>str</em></a>) – type of classification problem (see code)</p></li>
<li><p><strong>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of training samples</p></li>
<li><p><strong>nz</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – noise level (>0)</p></li>
<li><p><strong>p</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – proportion of one class in the binary setting</p></li>
<li><p><strong>random_state</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>, </em><em>RandomState instance</em><em> or </em><em>None</em><em>, </em><em>optional</em><em> (</em><em>default=None</em><em>)</em>) – If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by <cite>np.random</cite>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><ul class="simple">
<li><p><strong>X</strong> (<em>ndarray, shape (n, d)</em>) – <cite>n</cite> observation of size <cite>d</cite></p></li>
<li><p><strong>y</strong> (<em>ndarray, shape (n,)</em>) – labels of the samples.</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="examples-using-ot-datasets-make-data-classif">
<h3>Examples using <code class="docutils literal notranslate"><span class="pre">ot.datasets.make_data_classif</span></code><a class="headerlink" href="#examples-using-ot-datasets-make-data-classif" title="Link to this heading"></a></h3>
<div class="sphx-glr-thumbnails"><div class="sphx-glr-thumbcontainer" tooltip="Dual OT solvers for entropic and quadratic regularized OT with Pytorch"><img alt="" src="../_images/sphx_glr_plot_dual_ot_pytorch_thumb.png" />
<p><a class="reference internal" href="../auto_examples/backends/plot_dual_ot_pytorch.html"><span class="doc">Dual OT solvers for entropic and quadratic regularized OT with Pytorch</span></a></p>
<div class="sphx-glr-thumbnail-title">Dual OT solvers for entropic and quadratic regularized OT with Pytorch</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example introduces a domain adaptation in a 2D setting and OTDA approach with Laplacian regularization."><img alt="" src="../_images/sphx_glr_plot_otda_laplacian_thumb.png" />
<p><a class="reference internal" href="../auto_examples/domain-adaptation/plot_otda_laplacian.html"><span class="doc">OT with Laplacian regularization for domain adaptation</span></a></p>
<div class="sphx-glr-thumbnail-title">OT with Laplacian regularization for domain adaptation</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example presents how to use MappingTransport to estimate at the same time both the coupling transport and approximate the transport map with either a linear or a kernelized mapping as introduced in [8]."><img alt="" src="../_images/sphx_glr_plot_otda_mapping_thumb.png" />
<p><a class="reference internal" href="../auto_examples/domain-adaptation/plot_otda_mapping.html"><span class="doc">OT mapping estimation for domain adaptation</span></a></p>
<div class="sphx-glr-thumbnail-title">OT mapping estimation for domain adaptation</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example introduces a semi supervised domain adaptation in a 2D setting. It explicit the problem of semi supervised domain adaptation and introduces some optimal transport approaches to solve it."><img alt="" src="../_images/sphx_glr_plot_otda_semi_supervised_thumb.png" />
<p><a class="reference internal" href="../auto_examples/domain-adaptation/plot_otda_semi_supervised.html"><span class="doc">OTDA unsupervised vs semi-supervised setting</span></a></p>
<div class="sphx-glr-thumbnail-title">OTDA unsupervised vs semi-supervised setting</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example introduces a domain adaptation in a 2D setting and the 4 OTDA approaches currently supported in POT."><img alt="" src="../_images/sphx_glr_plot_otda_classes_thumb.png" />
<p><a class="reference internal" href="../auto_examples/domain-adaptation/plot_otda_classes.html"><span class="doc">OT for domain adaptation</span></a></p>
<div class="sphx-glr-thumbnail-title">OT for domain adaptation</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example introduces a domain adaptation in a 2D setting. It explicit the problem of domain adaptation and introduces some optimal transport approaches to solve it."><img alt="" src="../_images/sphx_glr_plot_otda_d2_thumb.png" />
<p><a class="reference internal" href="../auto_examples/domain-adaptation/plot_otda_d2.html"><span class="doc">OT for domain adaptation on empirical distributions</span></a></p>
<div class="sphx-glr-thumbnail-title">OT for domain adaptation on empirical distributions</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example introduces a target shift problem with two 2D source and 1 target domain."><img alt="" src="../_images/sphx_glr_plot_otda_jcpot_thumb.png" />
<p><a class="reference internal" href="../auto_examples/domain-adaptation/plot_otda_jcpot.html"><span class="doc">OT for multi-source target shift</span></a></p>
<div class="sphx-glr-thumbnail-title">OT for multi-source target shift</div>
</div></div><div class="sphx-glr-clear"></div><dl class="py function">
<dt class="sig sig-object py" id="ot.datasets.make_gauss_hd">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_gauss_hd</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ns</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dim</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m_diff</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">a</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(10.0,</span> <span class="pre">15.0)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(3.0,</span> <span class="pre">3.0)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sub_the_same</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_gauss_hd"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#ot.datasets.make_gauss_hd" title="Link to this definition"></a></dt>
<dd><p>Generation of source and target domains from Gaussian HD distributions</p>
<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>ns</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of samples (source)</p></li>
<li><p><strong>nt</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of samples (target)</p></li>
<li><p><strong>p</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – dimension of the ambient space the data live in</p></li>
<li><p><strong>dim</strong> (<em>(</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>) or </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – the intrinsic dimensions of the source and target Gaussian HD distriutions. If a single int the intrinsic dimension is assumed to be the same</p></li>
<li><p><strong>m_diff</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – the shift in the first coordinate of the means of the Gaussian HD distributions, i.e. ms_0 and mt_0, respectively (see code)</p></li>
<li><p><strong>a</strong> (<em>(</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>)</em>) – positive floating numbers corresponding to the isotropic variances in the principal subspace, for the source and target distributions, respectively. The same as delta in <span class="xref std std-ref">[1]</span>, Proposition 2.2</p></li>
<li><p><strong>b</strong> (<em>(</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>)</em>) – positive floating numbers corresponding to the isotropic variance outside the principal subspace for the source and target distributions, respectively.</p></li>
<li><p><strong>sub_the_same</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.14)"><em>bool</em></a>) – should the source/target Gaussian HD distributions live in the same principal subspace?</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><ul class="simple">
<li><p><strong>Xs</strong> (<em>ndarray, shape (ns, p)</em>) – <cite>ns</cite> observations of size <cite>p</cite> (source)</p></li>
<li><p><strong>Xt</strong> (<em>ndarray, shape (nt, p)</em>) – <cite>nt</cite> observations of size <cite>p</cite> (destination)</p></li>
<li><p><strong>pmts</strong> (<em>list</em>) – a list containing the parameters of the Gaussian HD distributions</p></li>
<li><p><em>.. _references-make_gauss_hd</em></p></li>
</ul>
</p>
</dd>
</dl>
<p class="rubric">References</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id1" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<p>Bouveyron, C. & Corneli, M. (“Scaling Optimal Transport to High-Dimensional Gaussian Distributions”)</p>
</aside>
</aside>
</dd></dl>
<div class="sphx-glr-clear"></div></section>
</section>
<dl class="py function">
<dt class="sig sig-object py" id="id0">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_1D_gauss</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">s</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_1D_gauss"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id0" title="Link to this definition"></a></dt>
<dd><p>return a 1D histogram for a gaussian distribution (<cite>n</cite> bins, mean <cite>m</cite> and std <cite>s</cite>)</p>
<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>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of bins in the histogram</p></li>
<li><p><strong>m</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – mean value of the gaussian distribution</p></li>
<li><p><strong>s</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – standard deviation of the gaussian distribution</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>h</strong> – 1D histogram for a gaussian distribution</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>ndarray (<cite>n</cite>,)</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="id2">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_2D_samples_gauss</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sigma</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">random_state</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_2D_samples_gauss"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id2" title="Link to this definition"></a></dt>
<dd><p>Return <cite>n</cite> samples drawn from 2D gaussian <span class="math notranslate nohighlight">\(\mathcal{N}(m, \sigma)\)</span></p>
<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>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of samples to make</p></li>
<li><p><strong>m</strong> (<em>ndarray</em><em>, </em><em>shape</em><em> (</em><em>2</em><em>,</em><em>)</em>) – mean value of the gaussian distribution</p></li>
<li><p><strong>sigma</strong> (<em>ndarray</em><em>, </em><em>shape</em><em> (</em><em>2</em><em>, </em><em>2</em><em>)</em>) – covariance matrix of the gaussian distribution</p></li>
<li><p><strong>random_state</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>, </em><em>RandomState instance</em><em> or </em><em>None</em><em>, </em><em>optional</em><em> (</em><em>default=None</em><em>)</em>) – If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by <cite>np.random</cite>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>X</strong> – n samples drawn from <span class="math notranslate nohighlight">\(\mathcal{N}(m, \sigma)\)</span>.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>ndarray, shape (<cite>n</cite>, 2)</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="id3">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_data_classif</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dataset</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nz</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">theta</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">random_state</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_data_classif"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id3" title="Link to this definition"></a></dt>
<dd><p>Dataset generation for classification problems</p>
<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>dataset</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.14)"><em>str</em></a>) – type of classification problem (see code)</p></li>
<li><p><strong>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of training samples</p></li>
<li><p><strong>nz</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – noise level (>0)</p></li>
<li><p><strong>p</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – proportion of one class in the binary setting</p></li>
<li><p><strong>random_state</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>, </em><em>RandomState instance</em><em> or </em><em>None</em><em>, </em><em>optional</em><em> (</em><em>default=None</em><em>)</em>) – If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by <cite>np.random</cite>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><ul class="simple">
<li><p><strong>X</strong> (<em>ndarray, shape (n, d)</em>) – <cite>n</cite> observation of size <cite>d</cite></p></li>
<li><p><strong>y</strong> (<em>ndarray, shape (n,)</em>) – labels of the samples.</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="id4">
<span class="sig-prename descclassname"><span class="pre">ot.datasets.</span></span><span class="sig-name descname"><span class="pre">make_gauss_hd</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ns</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dim</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m_diff</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">a</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(10.0,</span> <span class="pre">15.0)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(3.0,</span> <span class="pre">3.0)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sub_the_same</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ot/datasets.html#make_gauss_hd"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id4" title="Link to this definition"></a></dt>
<dd><p>Generation of source and target domains from Gaussian HD distributions</p>
<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>ns</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of samples (source)</p></li>
<li><p><strong>nt</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – number of samples (target)</p></li>
<li><p><strong>p</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – dimension of the ambient space the data live in</p></li>
<li><p><strong>dim</strong> (<em>(</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a><em>) or </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><em>int</em></a>) – the intrinsic dimensions of the source and target Gaussian HD distriutions. If a single int the intrinsic dimension is assumed to be the same</p></li>
<li><p><strong>m_diff</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a>) – the shift in the first coordinate of the means of the Gaussian HD distributions, i.e. ms_0 and mt_0, respectively (see code)</p></li>
<li><p><strong>a</strong> (<em>(</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>)</em>) – positive floating numbers corresponding to the isotropic variances in the principal subspace, for the source and target distributions, respectively. The same as delta in <span class="xref std std-ref">[1]</span>, Proposition 2.2</p></li>
<li><p><strong>b</strong> (<em>(</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.14)"><em>float</em></a><em>)</em>) – positive floating numbers corresponding to the isotropic variance outside the principal subspace for the source and target distributions, respectively.</p></li>
<li><p><strong>sub_the_same</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.14)"><em>bool</em></a>) – should the source/target Gaussian HD distributions live in the same principal subspace?</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><ul class="simple">
<li><p><strong>Xs</strong> (<em>ndarray, shape (ns, p)</em>) – <cite>ns</cite> observations of size <cite>p</cite> (source)</p></li>
<li><p><strong>Xt</strong> (<em>ndarray, shape (nt, p)</em>) – <cite>nt</cite> observations of size <cite>p</cite> (destination)</p></li>
<li><p><strong>pmts</strong> (<em>list</em>) – a list containing the parameters of the Gaussian HD distributions</p></li>
<li><p><em>.. _references-make_gauss_hd</em></p></li>
</ul>
</p>
</dd>
</dl>
<p class="rubric">References</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id5" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<p>Bouveyron, C. & Corneli, M. (“Scaling Optimal Transport to High-Dimensional Gaussian Distributions”)</p>
</aside>
</aside>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="ot.da.html" class="btn btn-neutral float-left" title="ot.da" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="ot.dr.html" class="btn btn-neutral float-right" title="ot.dr" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2016-2026, POT Contributors.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" data-toggle="rst-versions" role="note"
aria-label="versions">
<!-- add shift_up to the class for force viewing ,
data-toggle="rst-current-version" -->
<span class="rst-current-version" style="margin-bottom:1mm;">
<span class="fa fa-book"> Python Optimal Transport</span> 0.9.7
<hr style="margin-bottom:1.5mm;margin-top:5mm;">
<!-- versions
<span class="fa fa-caret-down"></span>-->
<span class="rst-current-version" style="display: inline-block;padding:
0px;color:#fcfcfcab;float:left;font-size: 100%;">
Versions:
<a href="https://pythonot.github.io/"
style="padding: 3px;color:#fcfcfc;font-size: 100%;">Release</a>
<a href="https://pythonot.github.io/master"
style="padding: 3px;color:#fcfcfc;font-size: 100%;">Development</a>
<a href="https://github.com/PythonOT/POT"
style="padding: 3px;color:#fcfcfc;font-size: 100%;">Code</a>
</span>
</span>
<!--
<div class="rst-other-versions">
<div class="injected">
<dl>
<dt>Versions</dt>
<dd><a href="https://pythonot.github.io/">Release</a></dd>
<dd><a href="https://pythonot.github.io/master">Development</a></dd>
<dt><a href="https://github.com/PythonOT/POT">Code on Github</a></dt>
</dl>
<hr>
</div>
</div>-->
</div><script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>