``glass_box_umap`` ================== .. py:module:: glass_box_umap Subpackages ----------- .. toctree:: :titlesonly: :maxdepth: 1 plotting/index.rst Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 jacobian/index.rst Overview -------- .. list-table:: Classes :header-rows: 0 :widths: auto :class: summarytable * - :py:obj:`GlassBoxUMAP ` - Glass Box UMAP model. * - :py:obj:`ParametricUMAP ` - Parametric UMAP model. Classes ------- .. autoclass:: GlassBoxUMAP Bases: :py:obj:`glass_box_umap.parametric_umap.ParametricUMAP` .. rubric:: Methods: .. py:method:: compute_contributions(X: numpy.typing.NDArray[numpy.floating] | torch.Tensor, batch_size: int | None = None, reduction: Literal['l2'] | None = None) -> numpy.typing.NDArray[numpy.float32] Compute per-feature contributions to the embedding via Gradient x Input. Projects gradients back to raw feature space if PCA preprocessing was used. :param X: The input data (same format as passed to fit/transform). Shape: (n_samples, n_features). :param batch_size: Batch size for Jacobian computation. Defaults to ``self.batch_size``. :param reduction: How to reduce contributions across embedding dimensions. If ``"l2"``, takes the L2 norm across components, returning shape (n_samples, n_features). If ``None``, returns the full (n_samples, n_components, n_features) array. :returns: Feature contributions array. Shape is (n_samples, n_components, n_features) when reduction is ``None``, or (n_samples, n_features) when a reduction is applied. .. py:method:: compute_jacobian(x: torch.Tensor, batch_size: int = 1024) -> torch.Tensor Compute the Jacobian of a model using ``vmap`` + ``jacrev`` with ``functional_call``. See :func:`glass_box_umap.jacobian.compute_jacobian` for details. .. autoclass:: ParametricUMAP .. rubric:: Methods: .. py:method:: to(device: str | torch.device) -> typing_extensions.Self Move the model (if initialized) and update the target device. .. py:method:: fit(X: numpy.typing.NDArray[numpy.floating] | torch.Tensor) -> typing_extensions.Self .. py:method:: transform(X: numpy.typing.NDArray[numpy.floating] | torch.Tensor, batch_size: int | None = None) -> numpy.typing.NDArray[numpy.floating] .. py:method:: fit_transform(X: numpy.typing.NDArray[numpy.floating] | torch.Tensor) -> numpy.typing.NDArray[numpy.floating] .. py:method:: save(path: pathlib.Path) -> None .. py:method:: load(path: pathlib.Path) -> typing_extensions.Self :classmethod: