hyrax.verbs.umap
================

.. py:module:: hyrax.verbs.umap


Attributes
----------

.. autoapisummary::

   hyrax.verbs.umap.logger


Classes
-------

.. autoapisummary::

   hyrax.verbs.umap.Umap


Module Contents
---------------

.. py:data:: logger

.. py:class:: Umap(config)

   Bases: :py:obj:`hyrax.verbs.verb_registry.Verb`


   Umap latent space points into 2d

   .. py:method:: __init__

   Overall initialization for all verbs that saves the config


   .. py:attribute:: cli_name
      :value: 'umap'



   .. py:attribute:: add_parser_kwargs


   .. py:method:: setup_parser(parser: argparse.ArgumentParser)
      :staticmethod:


      Stub of parser setup



   .. py:method:: run_cli(args: argparse.Namespace | None = None)

      Stub CLI implementation



   .. py:method:: run(input_dir: Union[pathlib.Path, str] | None = None)

      Create a umap of a particular inference run

      This method loads the latent space representations from an inference run,
      samples a subset of data points, flattens them if necessary, and then fits
      a UMAP model. The fitted reducer is then used to transform the entire dataset
      into a lower-dimensional space.

      :param input_dir: The directory containing the inference results.
      :type input_dir: str or Path, Optional

      :returns: The method does not return anything but saves the UMAP representations to disk.
      :rtype: None



   .. py:method:: _run(input_dir: Union[pathlib.Path, str] | None = None)

      See run()



   .. py:method:: _transform_batch(batch_tuple: tuple)

      Private helper to transform a single batch

      :param batch_tuple: first element is the IDs of the batch as a numpy array
                          second element is the inference results to transform as a numpy array with shape (batch_len, N)
                          where N is the total number of dimensions in the inference result. Caller flattens all inference
                          result axes for us.
      :type batch_tuple: tuple()

      :returns: first element is the ids of the batch as a numpy array
                second element is the results of running the umap transform on the input as a numpy array.
      :rtype: tuple



   .. py:method:: _log_memory_usage(message: str = '')
      :staticmethod:


      Log the current resident set size (RSS) memory usage of the current process in gigabytes.

      :param message: A descriptive message to include in the log output for context.
      :type message: str, optional

      .. rubric:: Notes

      This method is intended for debugging and performance monitoring.



