structboost.stability_selection

structboost.stability_selection(sourcemat, targetmat, *, n_genes=None, mandatory_features=None, mandatory_ridge=0.0, n_subsamples=100, subsample_frac=0.5, threshold=0.7, stepno=20, nu=0.1, csf=0.9, independent=True, seed=None, verbose=False)[source]

Run stability selection over subsamples of allboost.

Parameters:
  • sourcemat (ndarray[tuple[Any, ...], dtype[floating]]) – Predictor matrix, shape (n_samples, n_features). May include trailing nuisance columns; only the first n_genes columns are scored.

  • targetmat (ndarray[tuple[Any, ...], dtype[floating]]) – Target matrix, shape (n_samples, latent_dim). For BAE these are the functional-gradient targets z* (see BAE.stability_selection()), not the latent codes themselves — the codes are a sparse linear function of the already-selected genes, which makes selecting them nearly circular.

  • n_genes (int | None) – Number of leading columns of sourcemat that are genes. Frequencies are reported only for these. Defaults to all columns.

  • mandatory_features (ndarray[tuple[Any, ...], dtype[int64]] | list[ndarray[tuple[Any, ...], dtype[int64]]] | None) – Forwarded to allboost(), so the resampled problem matches the one the encoder solved (e.g. batch nuisance regressors). Mandatory columns beyond n_genes never appear in the reported frequencies.

  • mandatory_ridge (float | ndarray[tuple[Any, ...], dtype[floating]]) – Forwarded to allboost(), so the resampled problem matches the one the encoder solved (e.g. batch nuisance regressors). Mandatory columns beyond n_genes never appear in the reported frequencies.

  • n_subsamples (int) – Number of subsamples (B). More reduces Monte-Carlo noise in the frequencies; cost is linear.

  • subsample_frac (float) – Fraction of cells per subsample, drawn without replacement. 0.5 is the value Meinshausen-Bühlmann derive the error bound for; other values give frequencies but weaken the bound’s justification.

  • threshold (float) – Stability threshold pi in (0.5, 1]. Genes selected in at least this fraction of subsamples form the stable support. Must exceed 0.5 for the error bound to be defined.

  • stepno (int) – Boosting hyperparameters, forwarded to allboost(). Use the same values the encoder was fitted with.

  • nu (float) – Boosting hyperparameters, forwarded to allboost(). Use the same values the encoder was fitted with.

  • csf (float) – Boosting hyperparameters, forwarded to allboost(). Use the same values the encoder was fitted with.

  • independent (bool) – Boosting hyperparameters, forwarded to allboost(). Use the same values the encoder was fitted with.

  • seed (int | None) – Seed for the subsampling RNG.

  • verbose (bool) – Show a progress bar over the subsamples. Defaults to False so that calling this function directly stays silent; structboost.BAE.stability_selection() passes its own verbose through.

Returns:

StabilitySelectionResult

Return type:

StabilitySelectionResult