Skip to content

scdef.pl.obs_scores

obs_scores(model: scDEF, obs_keys: Sequence[str], hierarchy: Optional[Dict[str, Sequence[str]]] = None, mode: Literal['f1', 'fracs', 'weights', 'prob', 'soft_prec', 'score'] = 'fracs', vmax: Optional[float] = None, vmin: Optional[float] = None, **kwargs: Any) -> None

Plot the association between a set of cell annotations and factors.

Parameters:

Name Type Description Default
model scDEF

scDEF model instance

required
obs_keys Sequence[str]

the keys in model.adata.obs to use

required
hierarchy Optional[Dict[str, Sequence[str]]]

the polytree to restrict the associations to

None
mode Literal['f1', 'fracs', 'weights', 'prob', 'soft_prec', 'score']

scoring method:

  • "f1": hard F1 score (argmax assignments).
  • "fracs": hard precision / factor purity (P(obs=V | assigned to F)).
  • "weights": soft F1 score (harmonic mean of soft precision and soft recall, using X_<layer>_probs).
  • "prob": soft mean membership / soft recall (E[p(F) | obs=V]).
  • "soft_prec": soft precision (fraction of each factor's total soft mass in the obs category).
  • "score": mean raw cell-factor score (X_<layer>) per obs category — the obs-averaged analogue of obs_cell_factor_heatmap(values="score"). Values are not bounded to [0, 1].
'fracs'
**kwargs Any

plotting keyword arguments

{}