structboost¶
structboost
Structured representation learning for single-cell data. A latent space you can read gene by gene.
The Boosting Autoencoder (BAE) pairs a linear encoder fitted by componentwise L2 boosting with an MLP decoder trained by gradient descent. Each training iteration takes a gradient step on the latent code itself and hands the result to the boosting fit as a regression target, so the encoder is fitted against the gradient-updated latent code rather than by backpropagation. The target is that updated code rather than the gradient alone because the encoder is rebuilt from zero every iteration: it has to reproduce where the code should be, not the correction to where it already is. Componentwise boosting adds one gene at a time and shrinks each step, which keeps the encoder weights sparse by construction rather than by a post-hoc threshold.
Each latent dimension is therefore a short, signed gene list, and X_bae is
exactly X @ varm["BAE_encoder_weights"].
The package also ships allboost(), the componentwise boosting
routine on its own, for sparse supervised problems with no autoencoder involved.
from structboost import BAE, BAEConfig
model = BAE(adata.n_vars, BAEConfig(latent_dim=10))
model.fit(adata) # adata.X must be z-scored
adata.obsm["X_bae"] # (n_cells, 10)
adata.varm["BAE_encoder_weights"] # (n_genes, 10), sparse
The core install is NumPy-only. The BAE needs the [bae] extra.
What each capability is for, when it does not work, and the caveats worth knowing before you trust a gene list.
Every public symbol, grouped by the task it belongs to.
What changed, and the measurements behind each change.
When this is the right tool¶
BAE is built for the case where you have to be able to say which genes produced a latent axis, such as marker discovery, gene-program interpretation, or handing a representation to a collaborator who will check it against biology.
It is not built to win at reconstruction. A dense autoencoder might reconstruct better. The point here is that its latent dimensions cannot be read.
Exploratory features
Four capabilities are under active development and less settled than the core fit: stability selection, disentanglement, starting from an existing representation, and starting from a prior encoder matrix. They work and each is documented with what is known about it, but their behaviour, defaults and APIs are more likely to change. See the list in the user guide.
Citation¶
If you use the BAE:
Hackenberg, M., Brunn, N., Vogel, T. et al. Infusing structural assumptions into dimensionality reduction for single-cell RNA sequencing data to identify small gene sets. Commun Biol 8, 414 (2025). https://doi.org/10.1038/s42003-025-07872-9
If you use allboost:
Binder, H., Schumacher, M. Incorporating pathway information into boosting estimation of high-dimensional risk prediction models. BMC Bioinformatics 10, 18 (2009). https://doi.org/10.1186/1471-2105-10-18