soma
soma runs computational pathology experiments from images and labels to predictions, metrics, and reports. It combines preprocessing, frozen foundation-model features, and downstream training through a modular Python API or a YAML pipeline.
Install
Requires Python 3.11 or later:
pip install soma-pathology
The distribution is soma-pathology; the Python package and CLI are soma.
Run an experiment
For slide classification, prepare two CSV files:
dataset.csv: one row per slide with a uniquesample_id, animage_path, and alabel.splits.csv: columnssample_id,split, andfold, assigning every sample totrain,tune, or atest*split in each fold.
Use independent subjects across splits and include both classes in each split for binary AUROC. The getting started guide shows the manifests and a complete walkthrough.
from soma import (
AggregatorConfig,
EncoderConfig,
EvalConfig,
Pipeline,
PipelineConfig,
TaskConfig,
TrainingConfig,
)
config = PipelineConfig(
dataset_csv="dataset.csv",
splits_csv="splits.csv",
output_root="output",
dataset_type="slide",
encoder=EncoderConfig(name="phikon"),
aggregator=AggregatorConfig(name="abmil"),
task=TaskConfig(name="binary_classification"),
training=TrainingConfig(epochs=5, learning_rate=1e-4, seed=0),
evaluation=EvalConfig(metrics=["auroc", "balanced_accuracy"]),
)
result = Pipeline(config).run()
print(result.summary)
print(result.run_dir)
phikon weights are public and download on first use. Omitted tile size and spacing resolve from the encoder's native configuration. The pipeline preprocesses slides, extracts features, trains across folds, and evaluates predictions. result.fold_results contains per-fold results; result.run_dir locates the saved artifacts.
To reuse features across experiments, use Dataset and Splits to load data, FeatureExtractor.extract() to build a feature source, and train() or train_one_fold() for downstream training. The API guide shows this workflow and reporting examples.
Use the CLI
Run the same pipeline from a YAML config:
soma config.yaml
# Equivalent:
python -m soma config.yaml
soma merges the file with its bundled defaults. Start with the task examples or consult the CLI and configuration reference. Discover components with:
soma list encoders --level tile
soma list aggregators
soma list decoders
soma list pixel-classifiers
soma list tasks
soma list benchmarks
Explore
- How soma works: pipeline components and experiment design.
- Modeling paths: tile, slide, patient, and dense prediction workflows.
- Tutorials: task-specific walkthroughs.
- Benchmarking: fixed protocols and encoder comparisons, including task-free CRoMa evaluation.
- Caching and run outputs: feature reuse and experiment provenance.
License
Metadata
Release files for soma-pathology 1.14.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| soma_pathology-1.14.1.tar.gz | 482.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| soma_pathology-1.14.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / soma_pathology-1.14.1.tar.gz
| Download URL | soma_pathology-1.14.1.tar.gz |
|---|---|
| Size | 482.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35785c72937d62add60310c1561e547aca885f33b67b77f908ec598dbf3cdc74
|
|
BLAKE2b-256 checksum How to use checksums |
b043296d6e8b387c7bc7a20eb509cd22256bdb5c173ec59ac17e417a86b1c47e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / soma_pathology-1.14.1-py3-none-any.whl
| Download URL | soma_pathology-1.14.1-py3-none-any.whl |
|---|---|
| Size | 584.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7868272a9605ffa25506f9264a16c679ffc49d3f9c32eb973232f01461558c1e
|
|
BLAKE2b-256 checksum How to use checksums |
8c4bdd0df4c4ea088becb619f1012b7751e3166afb9833d1dd996ec4235b5348
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|