Skip to content

assign_OT

assign_OT(x, y, method='exact', reg=0.1, sym=False, return_indices=False)

Compute an OT pairing from x to y.

Parameters:

  • x (array-like of shape (n_x, d)) –

    Source samples.

  • y (array-like of shape (n_y, d)) –

    Target samples.

  • method (str, default: "exact" ) –

    OT solver method. If "exact", use ot.emd. Otherwise use ot.sinkhorn with the provided method name.

  • reg (float, default: 0.1 ) –

    Entropic regularization used by ot.sinkhorn.

  • sym (bool, default: False ) –

    If False, pair each source sample with argmax over transport rows. If True, use all nonzero transport entries via np.nonzero(pi).

  • return_indices (bool, default: False ) –

    If True, also return the source and target indices of the assignment pairs.

Returns:

  • xk ( ndarray of shape (n_x, d) ) –

    Source samples in pairing order.

  • yk ( ndarray of shape (n_x, d) ) –

    Target samples paired to xk.

  • i_idx ( (ndarray, optional) ) –

    Source indices of the assignment pairs. Returned only when return_indices=True.

  • j_idx ( (ndarray, optional) ) –

    Target indices of the assignment pairs. Returned only when return_indices=True.