Factored OT solvers (low rank, cost or OT plan)


ot.factored.factored_optimal_transport(Xa, Xb, a=None, b=None, reg=0.0, r=100, X0=None, stopThr=1e-07, numItermax=100, verbose=False, log=False, **kwargs)[source]

Solves factored OT problem and return OT plans and intermediate distribution

This function solve the following OT problem 40

\[\mathop{\arg \min}_\mu \quad W_2^2(\mu_a,\mu)+ W_2^2(\mu,\mu_b)\]

where :

  • \(\mu_a\) and \(\mu_b\) are empirical distributions.

  • \(\mu\) is an empirical distribution with r samples

And returns the two OT plans between


This function is backend-compatible and will work on arrays from all compatible backends. But the algorithm uses the C++ CPU backend which can lead to copy overhead on GPU arrays.

Uses the conditional gradient algorithm to solve the problem proposed in [39].

  • Xa ((ns,d) array-like, float) – Source samples

  • Xb ((nt,d) array-like, float) – Target samples

  • a ((ns,) array-like, float) – Source histogram (uniform weight if empty list)

  • b ((nt,) array-like, float) – Target histogram (uniform weight if empty list))

  • numItermax (int, optional) – Max number of iterations

  • stopThr (float, optional) – Stop threshold on the relative variation (>0)

  • verbose (bool, optional) – Print information along iterations

  • log (bool, optional) – record log if True


  • Ga (array-like, shape (ns, r)) – Optimal transportation matrix between source and the intermediate distribution

  • Gb (array-like, shape (r, nt)) – Optimal transportation matrix between the intermediate and target distribution

  • X (array-like, shape (r, d)) – Support of the intermediate distribution

  • log (dict, optional) – If input log is true, a dictionary containing the cost and dual variables and exit status



Forrow, A., Hütter, J. C., Nitzan, M., Rigollet, P., Schiebinger, G., & Weed, J. (2019, April). Statistical optimal transport via factored couplings. In The 22nd International Conference on Artificial Intelligence and Statistics (pp. 2454-2465). PMLR.

See also


Entropic regularized OT ot.optim.cg : General