paste3.paste.my_fused_gromov_wasserstein
- paste3.paste.my_fused_gromov_wasserstein(exp_dissim_matrix, a_spatial_dist, b_spatial_dist, a_spots_weight, b_spots_weight, alpha=0.5, overlap_fraction=None, pi_init=None, loss_fun='square_loss', armijo=False, numItermax=200, tol_rel=1e-09, tol_abs=1e-09, numItermaxEmd=100000, dummy=1, **kwargs)[source]
Computes a transport plan to align two weighted spatial distributions based on expression dissimilarity matrix and spatial distances, using the Gromov-Wasserstein framework. Also allows for partial alignment by specifying an overlap fraction.
- Parameters:
exp_dissim_matrix (torch.Tensor) -- Expression dissimilarity matrix between two slices.
a_spatial_dist (torch.Tensor) -- Spot distance matrix in the first slice.
b_spatial_dist (torch.Tensor) -- Spot distance matrix in the second slice.
a_spots_weight (torch.Tensor) -- Weight distribution for the spots in the first slice.
b_spots_weight (torch.Tensor) -- Weight distribution for the spots in the second slice.
alpha (float, Optional) -- Regularization parameter balancing transcriptional dissimilarity and spatial distance among aligned spots. Setting lpha = 0 uses only transcriptional information, while lpha = 1 uses only spatial coordinates.
overlap_fraction (float, Option) -- Fraction of overlap between the two slices, must be between 0 and 1. If None, full alignment is performed.
pi_init (torch.Tensor, Optional) -- Initial transport plan. If None, it will be computed.
loss_fun (str, Optional) -- Loss function to be used in optimization. Default is "square_loss".
armijo (bool, Optional) -- If True, uses Armijo rule for line search during optimization.
numItermax (int, Optional) -- Maximum number of iterations allowed for the optimization process.
tol_rel (float, Optional) -- Relative tolerance for convergence, by default 1e-9.
tol_abs (float, Optional) -- Absolute tolerance for convergence, by default 1e-9.
numItermaxEmd (int, Optional) -- Maximum iterations for Earth Mover's Distance (EMD) solver.
dummy (int, Optional) -- Number of dummy points for partial overlap, by default 1.
- Return type:
tuple
[ndarray
,dict
]- Returns:
Tuple[np.ndarray, Optional[dict]] --
pi : np.ndarray Optimal transport plan that minimizes the fused gromov-wasserstein distance between two distributions
info : Optional[dict] A dictionary containing details of teh optimization process.
For more info, see (https://pythonot.github.io/gen_modules/ot.gromov.html)