Skip to content

Commit 7c6f1f1

Browse files
Circle CICircle CI
authored andcommitted
CircleCI update of dev docs (768).
1 parent d633586 commit 7c6f1f1

168 files changed

Lines changed: 5241 additions & 12528 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Binary file not shown.

‎master/_downloads/5798c188b81f705c8a7ba8550573b0ae/plot_gromov.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,37 @@
104104
pl.title('Entropic Gromov Wasserstein')
105105

106106
pl.show()
107+
108+
#############################################################################
109+
#
110+
# Compute GW with a scalable stochastic method with any loss function
111+
# ----------------------------------------------------------------------
112+
113+
114+
def loss(x, y):
115+
return np.abs(x - y)
116+
117+
118+
pgw, plog = ot.gromov.pointwise_gromov_wasserstein(C1, C2, p, q, loss, max_iter=100,
119+
log=True)
120+
121+
sgw, slog = ot.gromov.sampled_gromov_wasserstein(C1, C2, p, q, loss, epsilon=0.1, max_iter=100,
122+
log=True)
123+
124+
print('Pointwise Gromov-Wasserstein distance estimated: ' + str(plog['gw_dist_estimated']))
125+
print('Variance estimated: ' + str(plog['gw_dist_std']))
126+
print('Sampled Gromov-Wasserstein distance: ' + str(slog['gw_dist_estimated']))
127+
print('Variance estimated: ' + str(slog['gw_dist_std']))
128+
129+
130+
pl.figure(1, (10, 5))
131+
132+
pl.subplot(1, 2, 1)
133+
pl.imshow(pgw.toarray(), cmap='jet')
134+
pl.title('Pointwise Gromov Wasserstein')
135+
136+
pl.subplot(1, 2, 2)
137+
pl.imshow(sgw, cmap='jet')
138+
pl.title('Sampled Gromov Wasserstein')
139+
140+
pl.show()
Binary file not shown.

‎master/_downloads/705e002e8bade030ed468515173797f7/plot_gromov.ipynb‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,24 @@
100100
"source": [
101101
"p = ot.unif(n_samples)\nq = ot.unif(n_samples)\n\ngw0, log0 = ot.gromov.gromov_wasserstein(\n C1, C2, p, q, 'square_loss', verbose=True, log=True)\n\ngw, log = ot.gromov.entropic_gromov_wasserstein(\n C1, C2, p, q, 'square_loss', epsilon=5e-4, log=True, verbose=True)\n\n\nprint('Gromov-Wasserstein distances: ' + str(log0['gw_dist']))\nprint('Entropic Gromov-Wasserstein distances: ' + str(log['gw_dist']))\n\n\npl.figure(1, (10, 5))\n\npl.subplot(1, 2, 1)\npl.imshow(gw0, cmap='jet')\npl.title('Gromov Wasserstein')\n\npl.subplot(1, 2, 2)\npl.imshow(gw, cmap='jet')\npl.title('Entropic Gromov Wasserstein')\n\npl.show()"
102102
]
103+
},
104+
{
105+
"cell_type": "markdown",
106+
"metadata": {},
107+
"source": [
108+
"## Compute GW with a scalable stochastic method with any loss function\n\n"
109+
]
110+
},
111+
{
112+
"cell_type": "code",
113+
"execution_count": null,
114+
"metadata": {
115+
"collapsed": false
116+
},
117+
"outputs": [],
118+
"source": [
119+
"def loss(x, y):\n return np.abs(x - y)\n\n\npgw, plog = ot.gromov.pointwise_gromov_wasserstein(C1, C2, p, q, loss, max_iter=100,\n log=True)\n\nsgw, slog = ot.gromov.sampled_gromov_wasserstein(C1, C2, p, q, loss, epsilon=0.1, max_iter=100,\n log=True)\n\nprint('Pointwise Gromov-Wasserstein distance estimated: ' + str(plog['gw_dist_estimated']))\nprint('Variance estimated: ' + str(plog['gw_dist_std']))\nprint('Sampled Gromov-Wasserstein distance: ' + str(slog['gw_dist_estimated']))\nprint('Variance estimated: ' + str(slog['gw_dist_std']))\n\n\npl.figure(1, (10, 5))\n\npl.subplot(1, 2, 1)\npl.imshow(pgw.toarray(), cmap='jet')\npl.title('Pointwise Gromov Wasserstein')\n\npl.subplot(1, 2, 2)\npl.imshow(sgw, cmap='jet')\npl.title('Sampled Gromov Wasserstein')\n\npl.show()"
120+
]
103121
}
104122
],
105123
"metadata": {
-508 Bytes
Loading
-93 Bytes
Loading
-19 Bytes
Loading
-1.04 KB
Loading
-443 Bytes
Loading
1.55 KB
Loading

0 commit comments

Comments
 (0)