First steps with Optimal Transport. 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.
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.
To start with, let us install POT using pip from the terminal by simply running
pip3 install pot
Or with conda
conda install -c conda-forge pot
If everything went well, you now have POT installed and ready to use on your computer.
import numpy as np ## always need it
import scipy as sp ## often use it
import pylab as pl ## do the plots
import ot ## ot
The online documentation of POT is available at http://pot.readthedocs.io, or you can check the inline help help(ot.dist)
.
We are now ready to start our example.
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. The Cafés where the croissants are sold are defined also by their position cafe_pos
and cafe_prod
, and describe the target distribution.
We supply you with world class machine learning experts / ML Developers with years of domain experience who can add more value to your business.
We supply you with world class machine learning experts / ML Developers with years of domain experience who can add more value to your business.
We supply you with world class machine learning experts / ML Developers with years of domain experience who can add more value to your business.
In this article, we explore gradient descent - the grandfather of all optimization techniques and it’s variations. We implement them from scratch with Python.
What is neuron analysis of a machine? Learn machine learning by designing Robotics algorithm. Click here for best machine learning course models with AI