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 dataset.csv (sample ID, image path, label) and splits.csv (sample ID, split, fold). The getting started guide shows both files 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. To extract features once and reuse them across experiments, see the API guide.
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 the CLI reference. soma list encoders (and aggregators, decoders, tasks, benchmarks) prints the registered components.
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.19.0
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.19.0.tar.gz | 548.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| soma_pathology-1.19.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.2 MB
Release files / soma_pathology-1.19.0.tar.gz
| Download URL | soma_pathology-1.19.0.tar.gz |
|---|---|
| Size | 548.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ed44416e0f45b9c6ab7f2d120c82abed290bacda1c3ac33d32b86464b2c5db2
|
|
BLAKE2b-256 checksum How to use checksums |
087e120c6107e30ecbc3cfaf6ffc230c7544bed4eb91afc48297a1ce5d689dcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / soma_pathology-1.19.0-py3-none-any.whl
| Download URL | soma_pathology-1.19.0-py3-none-any.whl |
|---|---|
| Size | 661.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db9069d9bda6516652254363c15843acefec07cac6934647948d47b4adc78f94
|
|
BLAKE2b-256 checksum How to use checksums |
90c0e1ee74fc31958b95192bcf4be6ed4f297706fe4f80bde558809911e16522
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|