mantispy.pp.decorr_threshold_sweep#

mantispy.pp.decorr_threshold_sweep(adata, thresholds, scorers, *, key='selected', **feature_select_kwargs)[source]#

Score decorrelate at a range of thresholds so the smallest set that holds a metric can be chosen.

decorr_threshold trades size for signal, and the right setting depends on the screen and on the metric that matters, so there is no universal best. This runs feature_select() with decorrelate=True at each threshold on a copy, scores the selected object with each callable, and returns one row per threshold.

Parameters:
adata AnnData

Object to select features on. Never modified.

thresholds Sequence[float]

decorr_threshold values to try.

scorers Mapping[str, Callable[[AnnData], float]] | Sequence[Callable[[AnnData], float]]

Scoring callables, each taking the selected AnnData and returning a scalar (for example replicate or activity mAP). A mapping names the columns; a sequence names them by callable.__name__.

key str (default: 'selected')

Boolean var column feature_select() writes and subset_features() reads.

feature_select_kwargs Any

Passed through to feature_select() (operations, corr_threshold, and so on); decorrelate, decorr_threshold, key_added and copy are set here.

Return type:

DataFrame

Returns:

A frame with a threshold column, an n_kept column, and one column per scorer.