Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/_static/diagrams/hyrax_schematic_excalidraw.excalidraw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/common_workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Common workflows
Checkpointing <pre_executed/hyrax_checkpointing>
Loading pretrained weights <pre_executed/load_pretrained_model>
Hyperparameter tuning <pre_executed/hyperparameter_tuning_examples>
Using UMAP <pre_executed/using_umap>
Using reduce_dimensions <pre_executed/using_reduce_dimensions>
Custom training metrics <notebooks/custom_training_metrics>
Dataset custom collation <notebooks/custom_dataset_collation>
Customizing prepare_inputs <notebooks/custom_prepare_inputs>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ search, and interactive exploration.
h.train() # Train any PyTorch model with automatic logging & multi-GPU support
h.infer() # Run inference and store results
h.save_to_database() # Index embeddings in a vector database
h.umap() # Reduce latent vectors to 2D/3D with UMAP
h.reduce_dimensions() # Reduce latent vectors to 2D/3D with dimensionality-reduction algorithm
h.visualize() # Interactively explore latent spaces in 2D or 3D
db = h.database_connection()
v = ... # numpy vector representing the object to search for
Expand Down
30 changes: 15 additions & 15 deletions docs/pre_executed/unsupervised_hsc_full_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,21 @@
"name": "stderr",
"output_type": "stream",
"text": [
"[2026-03-27 18:13:08,743 hyrax.verbs.umap:INFO] Saving UMAP results to /mmfs1/gscratch/dirac/aritrag/repos/hyrax/docs/pre_executed/results/20260327-181308-umap-QNSR\n",
"[2026-03-27 18:13:08,778 hyrax.verbs.umap:INFO] Fitting the UMAP\n",
"[2026-03-27 18:13:18,448 hyrax.verbs.umap:INFO] Saving fitted UMAP Reducer\n"
"[2026-06-24 17:04:27,154 hyrax.verbs.reduce_dimensions:INFO] Saving reduction results using umap to /Users/qiyuwang/Desktop/hyrax/docs/pre_executed/results/20260624-170427-umap-LNhc\n",
"[2026-06-24 17:04:27,159 hyrax.verbs.reduce_dimensions:INFO] No model_path specified. A new model will be fitted.\n",
"[2026-06-24 17:04:27,159 hyrax.verbs.reduction_algorithms.umap:INFO] Fitting the UMAP\n",
"[2026-06-24 17:04:31,013 hyrax.verbs.reduce_dimensions:INFO] Saving fitted umap reducer to result directory\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6f4d2b9c8e0b495ba1d76b0e44c55182",
"model_id": "f67593f48c554940a6671b3fdf129faa",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Creating lower dimensional representation using UMAP:: 0%| | 0/2 [00:00<?, ?it/s]"
"Creating lower dimensional representation using UMAP:: 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
Expand All @@ -243,16 +244,15 @@
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[90m[\u001b[0m2026-03-28T01:13:21Z \u001b[33mWARN \u001b[0m lance::dataset::write::insert\u001b[90m]\u001b[0m No existing dataset at /mmfs1/gscratch/dirac/aritrag/repos/hyrax/docs/pre_executed/results/20260327-181308-umap-QNSR/lance_db/results.lance, it will be created\n",
"[2026-03-27 18:13:22,511 hyrax.datasets.result_dataset:INFO] Optimizing Lance table after 2 batches\n",
"[2026-03-27 18:13:22,530 hyrax.datasets.result_dataset:INFO] Lance table optimization complete\n",
"[2026-03-27 18:13:22,530 hyrax.verbs.umap:INFO] Finished transforming all data through UMAP\n"
"[2026-06-24 17:04:32,764 hyrax.datasets.result_dataset:INFO] Optimizing Lance table after 1 batches\n",
"[2026-06-24 17:04:32,767 hyrax.datasets.result_dataset:INFO] Lance table optimization complete\n",
"[2026-06-24 17:04:32,767 hyrax.verbs.reduce_dimensions:INFO] Finished transforming all data with umap\n"
]
},
{
"data": {
"text/plain": [
"<hyrax.datasets.result_dataset.ResultDataset at 0x7f04518f8070>"
"<hyrax.datasets.result_dataset.ResultDataset at 0x3d7e76120>"
]
},
"execution_count": 6,
Expand All @@ -261,8 +261,8 @@
}
],
"source": [
"h.config[\"umap\"][\"UMAP\"][\"n_components\"] = 2\n",
"h.umap()"
"h.set_config(\"reduce.umap.kwargs.n_components\", 2)\n",
"h.reduce_dimensions(algorithm=\"umap\")"
]
},
{
Expand All @@ -281,7 +281,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"[2026-03-27 18:13:22,602 hyrax.prepare:INFO] Finished Prepare\n"
"[2026-06-24 17:04:32,797 hyrax.verbs.prepare:INFO] Finished Prepare\n"
]
}
],
Expand Down Expand Up @@ -1100,7 +1100,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "hyrax",
"language": "python",
"name": "python3"
},
Expand All @@ -1114,7 +1114,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.16"
"version": "3.12.13"
},
"nbsphinx": {
"execute": "never"
Expand Down
36 changes: 22 additions & 14 deletions docs/pre_executed/unsupervised_image_extragalactic.ipynb

Large diffs are not rendered by default.

755 changes: 755 additions & 0 deletions docs/pre_executed/using_reduce_dimensions.ipynb

Large diffs are not rendered by default.

535 changes: 0 additions & 535 deletions docs/pre_executed/using_umap.ipynb

This file was deleted.

2 changes: 1 addition & 1 deletion docs/pre_executed/working_with_results_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Result data in Hyrax\n",
"\n",
"Hyrax verbs like `infer` and `umap` return results as instances of `ResultDataset`, a convenience layer over the underlying [lance file format](https://lance.org/) stored on disk.\n",
"Hyrax verbs like `infer` and `reduce_dimensions` return results as instances of `ResultDataset`, a convenience layer over the underlying [lance file format](https://lance.org/) stored on disk.\n",
"\n",
"This notebook follows the [Getting Started](<getting_started.ipynb>) notebook, training a `HyraxCNN` model on CIFAR-10 data, then explores how to work directly with inference results."
]
Expand Down
18 changes: 10 additions & 8 deletions docs/verbs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ Returns a ``ResultDataset`` in a notebook context.
$ hyrax test


``umap``
--------
Run `UMAP <https://umap-learn.readthedocs.io>`_ on the output of inference
to reduce high-dimensional embeddings to 2D (or 3D) for visualization. By
default, Hyrax uses the most recent inference output. See the
:doc:`UMAP notebook </pre_executed/using_umap>` for configuration options.
``reduce_dimensions``
---------------------
Run dimensionality-reduction algorithm `UMAP <https://umap-learn.readthedocs.io>`_ ,
`t-SNE <https://scikit-learn.org/stable/modules/generated/sklearn.manifold.TSNE.html>`_,
or `PCA <https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html>`_
on the output of inference to reduce high-dimensional embeddings to 2D (or 3D) for visualization.
By default, Hyrax uses the most recent inference output. See the
:doc:`reduce_dimensions notebook </pre_executed/using_reduce_dimensions>` for configuration options.

Returns a ``ResultDataset`` containing the reduced embeddings.

Expand All @@ -91,13 +93,13 @@ Returns a ``ResultDataset`` containing the reduced embeddings.

.. code-block:: python

h.umap()
h.reduce_dimensions()

.. tab-item:: CLI

.. code-block:: bash

$ hyrax umap [-i <path_to_inference_output>]
$ hyrax reduce_dimensions [-i <path_to_inference_output>]


``visualize``
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ dependencies = [
"scipy", # Used in Holoviews visualization prototype
"cython", # Used in Holoviews visualization prototype
"mlflow >= 3.7", # Used to log training metrics and compare models
"umap-learn", # Used to map latent spaces down to 2d
"scikit-learn", # Used to map latent spaces down for t-sne and pca
"umap-learn", # Used to map latent spaces down to 2d with umap
"pooch", # Used to download data files
"pydantic>=2.13.4,<3.0", # Used for typed configuration schemas
"onnx", # Used to export models to ONNX format
Expand Down
Loading