hyrax.verbs.reduce_dimensions#
Attributes#
Classes#
Verb to reduce the dimensionality of a dataset |
Module Contents#
- class ReduceDimensions(config)[source]#
Bases:
hyrax.verbs.verb_registry.VerbVerb to reduce the dimensionality of a dataset
Overall initialization for all verbs that saves the config
- description = 'Reduce the dimensionality of a dataset using provided or default reduction algorithm.'[source]#
- static setup_parser(parser: argparse.ArgumentParser)[source]#
Setup parser for reduce-dimensions verb
- run(algorithm: str | None = None, input_dir: pathlib.Path | str | None = None, model_path: pathlib.Path | str | None = None)[source]#
Run dimensionality reduction on a dataset
This method loads the latent space representations from an inference run and applies the selected dimensionality reduction algorithm.
Algorithms that support reusable fitted models may either:
fit a new model using a sampled subset of the data, or
load an existing model if a model path is provided.
Algorithms without a separate fitting stage do not support model loading and directly transform the input data.
The full dataset is then transformed into the target lower-dimensional space, and the resulting embeddings are saved.
- Parameters:
algorithm (str, Optional) – The dimensionality reduction algorithm to use. If not specified, the method will look in the config for a default algorithm.
input_dir (str or Path, Optional) – Directory containing the dataset to reduce dimensions for.
model_path (str or Path, Optional) – Path to a previously saved reducer model.
- Returns:
The method does not return anything but saves the algorithm reducer representations to disk.
- Return type:
None