paste3.model_selection.convex_hull_edge_inconsistency

paste3.model_selection.convex_hull_edge_inconsistency(slice, pi, axis)[source]

Computes the edge inconsistency score for a convex hull formed by the aligned spots in a slice, based on their probability masses (\(\pi\)). This score reflects the inconsistency in edges within a subgraph of aligned spots.

Specifically, let \(G = (V, E)\) be a graph and let \(L = [l(i)]\) be a labeling of nodes where \(l(i) \in {1, 2}\) is the cluster label of node \(i\). Let \(E'\) be the subset of the edges where the labelling of the nodes at the two ends are different, i.e. \(E'\) is the cut of the graph. The edge inconsistency score is defined as :math:`H (G, L) = H(G, L) =

rac{|E'|}{|E|}`, which is the percentage

of edges that are in the cut.

A high inconsistency score means most of the edges are in the cut, indicating the labeling of the nodes has low spatial coherence, while a low inconsistency score means that the two classes are nodes are mostly contiguous in graph.

sliceAnnData

AnnData object containing data for a slice.

pitorch.Tensor

Optimal transport plan for aligning two slices.

axisint

The axis along which the probability mass (pi) is summed to determine the alignment status of each spot. Axis = 1 determines mass distribution for spots in the first slice, while axis = 0 determines mass distribution for spots in the second slice.

float

The edge inconsistency score of the graph formed by the aligned spots. This score quantifies the irregularity or inconsistency of edges between aligned regions.