Apache License 2.0

项目介绍

ott-jax/ott 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 Apache License 2.0 许可证,目前获得 772 个 Star、144 次 Fork。

仓库全名
ott-jax/ott
开源许可证
Apache License 2.0
Star 数
772
Fork 数
144
未关闭 Issue
73

README 摘要

Optimal Transport Tools (OTT) See the full documentation. What is OTT-JAX? A JAX powered library to solve a wide variety of problems leveraging optimal transport theory, at scale and on accelerators. In particular, OTT-JAX implements various discrete solvers to match two point clouds, notably the Sinkhorn algorithm implemented to work on various geometric domains and sped up using various tweaks (scheduling,…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ott 用什么语言开发?

主要使用 Python 编写,采用 Apache License 2.0 许可证,目前有 772 个 Star。

ott 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 ott 的源码?

可以直接克隆仓库:git clone https://github.com/ott-jax/ott.git,默认分支为 main;安装与运行步骤见仓库 README。

ott 最近还在维护吗?

仓库最近一次更新为 2 天前,当前有 73 个未关闭 Issue;Star 数为 772,可作为社区活跃度的参考。

关于

Optimal transport tools implemented with the JAX framework, to solve large scale matching problems of any flavor.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
1070
价值分
503
活跃状态
活跃

语言占比

Python

Release

README

logo

Optimal Transport Tools (OTT)

Downloads Tests Docs Coverage

See the full documentation.

What is OTT-JAX?

A JAX powered library to solve a wide variety of problems leveraging optimal transport theory, at scale and on accelerators.

In particular, OTT-JAX implements various discrete solvers to match two point clouds, notably the Sinkhorn algorithm implemented to work on various geometric domains and sped up using various tweaks (scheduling, momentum, acceleration, initializations) and extensions (low-rank).

These algorithms power the resolution of more advanced problems (Gromov-Wasserstein, Wasserstein barycenter) to compare point clouds in versatile settings.

On top of these discrete solvers, we also propose implementations of neural network approaches. Given an source/target pair of measure, they output a neural net network that seeks to approximation their optimal transport map.

OTT-JAX is led by a team of researchers at Apple, with past contributions from Google and Meta researchers, as well as academic partners, including TU München, Oxford, ENSAE/IP Paris, ENS Paris and the Hebrew University.

Installation

Install OTT-JAX from PyPI as:

pip install ott-jax

or with conda via conda-forge as:

conda install -c conda-forge ott-jax

What is optimal transport?

Optimal transport can be loosely described as the branch of mathematics and optimization that studies matching problems: given two families of points, and a cost function on pairs of points, find a “good” (low cost) way to associate bijectively to every point in the first family another in the second.

Such problems appear in all areas of science, are easy to describe, yet hard to solve. Indeed, while matching optimally two sets of $n$ points using a pairwise cost can be solved with the Hungarian algorithm, solving it costs an order of $O(n^3)$ operations, and lacks flexibility, since one may want to couple families of different sizes.

Optimal transport extends all of this, through faster algorithms (in $n^2$ or even linear in $n$) along with numerous generalizations that can help it handle weighted sets of different size, partial matchings, and even more evolved so-called quadratic matching problems.

In the simple toy example below, we compute the optimal coupling matrix between two point clouds sampled randomly (2D vectors, compared with the squared Euclidean distance):

Example

import jax
import jax.numpy as jnp

from ott.geometry import pointcloud
from ott.problems.linear import linear_problem
from ott.solvers import linear
from ott.tools import plot

# sample two point clouds and their weights.
rngs = jax.random.split(jax.random.key(42), 4)
n, m, d = 6, 11, 2
x = jax.random.uniform(rngs[0], (n,d))
y = jax.random.uniform(rngs[1], (m,d))
a = jax.random.uniform(rngs[2], (n,)) +.2
b = jax.random.uniform(rngs[3], (m,)) +.2
a, b = a / jnp.sum(a), b / jnp.sum(b)
# instantiate geometry object to compare point clouds.
geom = pointcloud.PointCloud(x, y)
# compute coupling using the Sinkhorn algorithm.
out = jax.jit(linear.solve)(geom,a,b)

# plot
plot.Plot()(out)

The call to solve(prob) above works out the optimal transport solution. The out object contains a transport matrix (here of size $12\times 14$) that quantifies the association strength between each point of the first point cloud, to one or more points from the second, as illustrated in the plot below. We provide more flexibility to define custom cost functions, objectives, and solvers, as detailed in the full documentation. The last command displays the transport matrix by using a Plot object.

obtained coupling

Citation

If you have found this work useful, please consider citing this reference:

@article{cuturi2022optimal,
  title={Optimal Transport Tools (OTT): A JAX Toolbox for all things Wasserstein},
  author={Cuturi, Marco and Meng-Papaxanthos, Laetitia and Tian, Yingtao and Bunne, Charlotte and
          Davis, Geoff and Teboul, Olivier},
  journal={arXiv preprint arXiv:2201.12324},
  year={2022}
}

See also

The moscot package for OT analysis of multi-omics data uses OTT as a backbone.

评论

暂无评论