cot.transport_lmr

cot.transport_lmr(DA, SB, C, eps)[source]

This function sloves the additive approximation of optimal transport problem between two discrete distributions and returns the approximated cost based on the graph-based additive approximation algorithm [1] for OT.

Parameters:
  • DA (numpy array, shape (n,)) – A n by 1 tensor, the weight of samples from the demand distribution (type a), each DA[i] represents the mass of demand on i-th type a vertex. The sum of DA should equal to 1.

  • SB (numpy array, shape (n,)) – A n by 1 tensor, the weight of samples from the source distribution (type b), each SB[i] represents the mass of supply on i-th type b vertex. The sum of SB should equal to 1.

  • C (numpy array, shape (n, n)) – A n by n cost matrix, each C(i,j) represents the cost between i-th type b and j-th type a vertex.

  • eps (float) – The additive error of optimal transport distance, the value of \(\epsilon\) in the LMR paper [1] .

Returns:

ot_cost

Return type:

float

References