atlas.tl.terminal_state_silhouette#
- atlas.tl.terminal_state_silhouette(mudata, fate_key='fate_probabilities', soft_assignment=True, time_key=None, alpha=1)#
Compute the silhouette score for terminal states.
This metric evaluates whether cells committed to the same lineage are more similar to each other than to cells belonging to other lineages. It extends the classical silhouette score to probabilistic fate assignments.
Two strategies are supported to handle partially committed cells:
Soft assignment: cells are not assigned to a single lineage, and distances are weighted by fate probabilities.
Pseudotime weighting: silhouette scores are weighted by pseudotime, giving more importance to committed cells.
The silhouette score is computed as:
where is the intra-terminal distance and is the nearest-terminal distance.
When
soft_assignment=False, the final score is computed as:S = \\frac{\\sum_i \\tau_i^\\alpha s_i}{\\sum_i \\tau_i^\\alpha}where is the pseudotime of cell .
- Parameters:
mudata (
MuData) – Annotated multimodal data object.fate_key (
str(default:'fate_probabilities')) – Key inmudata.obsmcontaining fate probabilities (cells × terminal states).soft_assignment (
bool(default:True)) – Whether to use the soft assignment strategy. IfFalse, hard assignment with pseudotime weighting is used.time_key (
str|None(default:None)) – Key inmudata.obscontaining pseudotime values. Required whensoft_assignment=False.alpha (
float(default:1)) – Exponent used to weight pseudotime in the silhouette aggregation.
- Return type:
- Returns:
Terminal state silhouette score.