python 工具箱_掌握python最佳运输工具箱第1部分的指南

python 工具箱

As a follow-up of the introductory article on optimal transport by Ievgen Redko, I will present below how you can solve Optimal Transport (OT) in practice using the Python Optimal Transport (POT) toolbox.

作为Ievgen Redko 关于最佳运输入门文章的后续,我将在下面介绍如何使用Python最佳运输(POT)工具箱在实践中解决最佳运输(OT)。

To start with, let us install POT using pip from the terminal by simply running

首先,让我们简单地从终端使用pip安装POT

pip3 install pot

Or with conda

或用conda

conda install -c conda-forge pot

If everything went well, you now have POT installed and ready to use on your computer.

如果一切顺利,那么您现在已经安装了POT,可以在计算机上使用了。

POT Python最佳运输工具箱 (POT Python Optimal Transport Toolbox)

导入工具箱 (Import the toolbox)

import numpy as np # always need it
import scipy as sp # often use it
import pylab as pl # do the plotsimport ot # ot

获得帮助 (Getting help)

The online documentation of POT is available at http://pot.readthedocs.io, or you can check the inline help help(ot.dist) .

有关POT的在线文档,请访问http://pot.readthedocs.io,也可以查看内联帮助help(ot.dist)

We are now ready to start our example.

现在我们准备开始我们的示例。

简单的OT问题 (Simple OT Problem)

We will solve the Bakery/Cafés problem of transporting croissants from a number of Bakeries to Cafés in a City (in this case Manhattan). We did a quick google map search in Manhattan for bakeries and Cafés:

我们将解决面包店/咖啡馆将羊角面包从许多面包店运送到城市中的咖啡馆的问题(在本例中为曼哈顿)。 我们在曼哈顿进行了谷歌地图快速搜索,搜索面包店和咖啡馆:

We extracted from this search their positions and generated fictional production and sale number (that both sum to the same value).

我们从此搜索中提取了他们的职位,并生成了虚构的生产和销售数量(两者的总和为相同的值)。

We have access to the position of Bakeries bakery_pos and their respective production bakery_prod which describe the source distribution

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值