Skip to main content

GAHIB

PyPI DOI

A PyTorch implementation of a graph-attention variational autoencoder with an information bottleneck and a Lorentz hyperbolic geometry loss, applied to single-cell RNA-seq latent representation learning.

What it does

Given a scanpy AnnData with raw counts, GAHIB fits a VAE whose encoder can be an MLP, a Transformer, or a graph neural network (GAT, GCN, GraphSAGE, ChebConv, TAG, GraphTransformer, ARMA). The latent code is shaped by three losses:

  • a reconstruction term (NB, ZINB, Poisson, or ZIP),
  • an information-bottleneck term that compresses the latent into a 2D manifold coordinate, and
  • a Lorentz-hyperbolic term that anchors the manifold coordinate on the hyperboloid so radial distance encodes hierarchy.

Install

pip install gahib
# graph encoders, scanpy and scVI helpers
pip install "gahib[all]"

For development, clone the repository and run pip install -e ".[all]".

Python 3.9 or later. Full dependency list in pyproject.toml.

Usage

import scanpy as sc
from gahib import GAHIB

adata = sc.read_h5ad("data/human_cd34_bone_marrow.h5ad")

model = GAHIB(
    adata,
    layer="counts",
    encoder_type="graph",
    graph_type="GAT",
    latent_dim=10,
    i_dim=2,
    irecon=1.0,
    lorentz=5.0,
)

model.fit(epochs=200, patience=30)
Z = model.get_latent()

Set encoder_type="mlp" (default) for a plain VAE without the graph encoder.

Important constraint

The hyperbolic loss depends on the information-bottleneck target. With irecon=0, the bottleneck coordinate is untrained and the Lorentz distance becomes degenerate. Set irecon above zero whenever lorentz is above zero, as in the usage example; the model does not check this.

Main outputs

Call Returns
model.get_latent() latent code sampled from each cell's posterior, shape (n_cells, latent_dim)
model.get_centroid() posterior mean of each cell's latent code (no sampling), shape (n_cells, latent_dim)

Experiment runners

The experiments/ directory contains reproducible runners for the benchmark and robustness studies. Each runner takes its dataset paths from GAHIB_DATASET_DIRS and writes results to GAHIB_results/{study}/.

Repository layout

gahib/       package source (core model, metrics, interpretation)
experiments/ benchmark and robustness runners
tests/       pytest suite

Tests

pytest

Citation

If you use GAHIB, please cite the article:

Fu Z, Fu J, Wang X, Liu Y, Ran T. GAHIB: graph attention VAE with a hyperbolic information bottleneck for biologically structured single-cell representations. Frontiers in Genetics. 2026;17:1863100. https://doi.org/10.3389/fgene.2026.1863100

@article{fu2026gahib,
  author  = {Fu, Zeyu and Fu, Jiawei and Wang, Xiaoxia and Liu, Yiyao and Ran, Tianfei},
  title   = {GAHIB: graph attention VAE with a hyperbolic information bottleneck for biologically structured single-cell representations},
  journal = {Frontiers in Genetics},
  volume  = {17},
  pages   = {1863100},
  year    = {2026},
  doi     = {10.3389/fgene.2026.1863100}
}

GitHub's "Cite this repository" button reads the same record from CITATION.cff.

License

MIT. See LICENSE.

Metadata

Release files for gahib 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gahib 2.0.1
File Size Uploaded Provenance Actions
gahib-2.0.1.tar.gz 52.8 kB With provenance Details for gahib-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gahib 2.0.1
File Interpreter ABI Platform Actions
gahib-2.0.1-py3-none-any.whl Python 3 none any Details for gahib-2.0.1-py3-none-any.whl

Total release size: 106.7 kB

Release files / gahib-2.0.1.tar.gz

Download URL gahib-2.0.1.tar.gz
Size 52.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e67100049ebb24299a15cbe2ea5aba15f86c1c4dd7e7e50bdd4690ebdc44941f
BLAKE2b-256 checksum
How to use checksums
2f3b7dfd251840bc07eed5e34da6bc40845153219f1ff4e77d657b870e37c09f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / gahib-2.0.1-py3-none-any.whl

Download URL gahib-2.0.1-py3-none-any.whl
Size 53.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b76be846d3826aff2d2add9dcc0c62d8f349d62565c41d79e68715a38123ea7f
BLAKE2b-256 checksum
How to use checksums
e13ca71578b53c5384deade17cd8e61b8cc309b37aa3d686e64994da96c22084
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for gahib 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gahib-2.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page