注意
跳转到末尾 以下载完整示例代码。
平滑和稀疏 OT 示例
此示例说明了平滑和稀疏(KL和L2正则化)OT的计算,以及稀疏约束OT的计算及其可视化。
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
# sphinx_gallery_thumbnail_number = 5
import numpy as np
import matplotlib.pylab as pl
import ot
import ot.plot
from ot.datasets import make_1D_gauss as gauss
生成数据
绘制分布和损失矩阵

<matplotlib.legend.Legend object at 0x7f590d7a33d0>
pl.figure(2, figsize=(5, 5))
ot.plot.plot1D_mat(a, b, M, "Cost matrix M")

(<Axes: >, <Axes: >, <Axes: >)
解决平滑OT



脚本的总运行时间: (0分钟 0.649秒)