H-Optimus notebook
h1-jumpstart — a full, runnable H-Optimus embedding example.M-Optimus notebook
m-jumpstart — the equivalent for M-Optimus.1. Configure the model
Embeddings are available from both models. Import once, then pick your backend and model — the rest of the guide is identical.- On-premise
- AWS SageMaker
2. Extract embeddings
On a single-GPU SageMaker endpoint (
ml.g5.xlarge), lower max_concurrency (e.g. 32) to avoid out-of-memory from concurrent tile requests.3. PCA
Load the embeddings and fit PCA in one call —bioptimus.utils.plot_pca_scatter fits, plots, and returns the scores plus the fitted PCA (explained-variance ratios are printed):

PCA of tile embeddings on a TCGA-LUAD slide (TCGA-75-7027); PC1 explains 27.5%, PC2 13.0% of variance. Points are colored by tile index. Representative example.
4. Spatial visualization
plot_spatial_pca maps the PC scores back onto tile coordinates as per-PC spatial heatmaps — each component tends to isolate a distinct tissue compartment:

Spatial heatmaps of PC1–PC3 on a TCGA-LUAD slide (TCGA-75-7027). Each principal component highlights a different tissue compartment. Representative example.

