hyrax.verbs.reduce_dimensions#

Attributes#

Classes#

ReduceDimensions

Verb to reduce the dimensionality of a dataset

Module Contents#

logger[source]#
class ReduceDimensions(config)[source]#

Bases: hyrax.verbs.verb_registry.Verb

Verb to reduce the dimensionality of a dataset

__init__()[source]#

Overall initialization for all verbs that saves the config

cli_name = 'reduce_dimensions'[source]#
add_parser_kwargs[source]#
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_cli(args: argparse.Namespace | None = None)[source]#

CLI stub for ReduceDimensions 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

_run(algorithm: str | None, input_dir: pathlib.Path | str | None, model_path: pathlib.Path | str | None)[source]#

See run()