Transform
A transform modifies batches, splits, and assets. Transforms follow a
scikit-learn-style API: optional fit() on the
full dataset, then transform() applied to each
shard. Transforms can be composed with Compose.
There are two execution modes:
Offline transforms are applied via
apply()and written to a new on-disk hash directory. Use these for expensive, dataset-wide operations (tokenization, graph construction, normalization).Live transforms are attached via
live()and run at load time inside a benchmark loader. Use these for augmentations or featurization that should vary between epochs.
See Transforms for the full catalog.
- class bioverse.transform.Compose(*transforms: Transform)[source]
Bases:
TransformApply a sequence of transforms in order.
Examples
from bioverse.transform import Compose from bioverse.transforms import TokenizeResidues, KnnGraph pipeline = Compose(TokenizeResidues(), KnnGraph(k=16)) batches, split, assets = pipeline(batches, split, assets)
- class bioverse.transform.Transform[source]
Bases:
objectModify batches, splits, and assets in a scikit-learn-style pipeline.
Transforms follow a
fit→transformlifecycle. Offline transforms are applied viaapply()and materialized to disk; live transforms run at load time vialive().Override
transform_batch(),transform_split(), and/ortransform_assets()to implement specific operations. Setfilterto"scenes"to drop scenes marked by ascene_filtercolumn.Examples
Offline transform applied when building a dataset:
from bioverse.transforms import TokenizeResidues, KnnGraph dataset.apply(TokenizeResidues(), KnnGraph(k=16))Live augmentation attached to a benchmark:
from bioverse.transforms import Random2DRotate benchmark.live(Random2DRotate())