paste3.paste.line_search_partial

paste3.paste.line_search_partial(alpha, exp_dissim_matrix, pi, a_spatial_dist, b_spatial_dist, pi_diff, f_cost, f_gradient)[source]

Solve the linesearch in the fused wasserstein iterations for partially overlapping slices

Parameters:
  • alpha (float) -- Regularization parameter balancing transcriptional dissimilarity and spatial distance among aligned spots. Setting \(\alpha = 0\) uses only transcriptional information, while \(\alpha = 1\) uses only spatial coordinates.

  • exp_dissim_matrix (torch.Tensor) -- Expression dissimilarity matrix between two slices.

  • pi (torch.Tensor) -- The transport map at a given iteration of the FW.

  • a_spatial_dist (torch.Tensor) -- Spot distance matrix in the first slice.

  • b_spatial_dist (torch.Tensor) -- Spot distance matrix in the first slice.

  • pi_diff (torch.Tensor) -- Difference between the optimal map found by linearization in the fused wasserstein algorithm and the value at a given iteration

  • loss_fun (str, Optional) -- Loss function to be used in optimization. Default is "square_loss".

Returns:

  • minimal_cost (float) -- The optimal step size of the fused wasserstein

  • a (float) -- The computed value for the first cost component.

  • cost_G (float) -- The final cost after the update of the transport plan.