Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
spaCR
Logo
spaCR
  • Module audit
  • Localization
  • Setting animation gallery
  • Checkpoint and resume
  • Reproducibility manifests
  • Unified run history
  • Plate and batch-effect correction
  • Classifier evaluation workbench
  • Resumable multi-objective UMAP search
  • Remote and distributed execution
  • spaCR plugin SDK
  • Train/test leakage audit
  • Threading and cancellation audit
  • Database concurrency audit
  • API Reference
    • spacr
      • spacr.__main__
      • spacr.active_learning
      • spacr.agreement
      • spacr.align
      • spacr.anndata_export
      • spacr.app_annotate
      • spacr.app_classify
      • spacr.app_make_masks
      • spacr.app_mask
      • spacr.app_measure
      • spacr.app_sequencing
      • spacr.app_umap
      • spacr.artifacts
      • spacr.attribution
      • spacr.batch
      • spacr.batch_correction
      • spacr.cancellation
      • spacr.chaining
      • spacr.checkpoint
      • spacr.classifier_evaluation
      • spacr.cli
      • spacr.cli_database
      • spacr.cli_leakage
      • spacr.cli_plugins
      • spacr.cli_remote
      • spacr.cli_repro
      • spacr.confusion
      • spacr.convert
      • spacr.core
      • spacr.counting
      • spacr.crashreport
      • spacr.crops
      • spacr.curation
      • spacr.custom_features
      • spacr.data_manager
      • spacr.database_concurrency
      • spacr.database_schema
      • spacr.deep_spacr
      • spacr.diameter
      • spacr.doctor
      • spacr.errors
      • spacr.external_masks
      • spacr.feature_dict
      • spacr.foreign
      • spacr.gui
      • spacr.gui_core
      • spacr.gui_elements
      • spacr.gui_utils
      • spacr.hits
      • spacr.hyperparam
      • spacr.illumination
      • spacr.image_colors
      • spacr.io
      • spacr.layers
      • spacr.lineage
      • spacr.logger
      • spacr.logging_util
      • spacr.macro
      • spacr.mask_io
      • spacr.measure
      • spacr.measure_hooks
      • spacr.measurement_schema
      • spacr.methods_export
      • spacr.ml
      • spacr.model_compare
      • spacr.model_zoo
      • spacr.napari_bridge
      • spacr.notebook_export
      • spacr.object
      • spacr.ome_zarr
      • spacr.omero
      • spacr.pipeline_graph
      • spacr.pipeline_v2
      • spacr.plate_qc
      • spacr.plot
      • spacr.plugins
      • spacr.ports
      • spacr.power_model
      • spacr.power_simulate
      • spacr.predictions
      • spacr.profiler
      • spacr.projects
      • spacr.qt
        • spacr.qt.__main__
        • spacr.qt.ai
          • spacr.qt.ai.github_auth
          • spacr.qt.ai.issue_report
          • spacr.qt.ai.keys
          • spacr.qt.ai.manuscript
          • spacr.qt.ai.prompts
          • spacr.qt.ai.providers
          • spacr.qt.ai.settings
          • spacr.qt.ai.worker
        • spacr.qt.annotate_engine
        • spacr.qt.app
        • spacr.qt.bridge
        • spacr.qt.button_roles
        • spacr.qt.chaining
        • spacr.qt.command_palette
        • spacr.qt.comparison_grid
        • spacr.qt.counting_tool
        • spacr.qt.crop_thumbs
        • spacr.qt.curation_tool
        • spacr.qt.dnd
        • spacr.qt.dnd_handlers
        • spacr.qt.first_run
        • spacr.qt.folder_metadata
        • spacr.qt.hf_download
        • spacr.qt.i18n
        • spacr.qt.i18n_module_summaries
        • spacr.qt.i18n_module_summaries_asia
        • spacr.qt.i18n_module_summaries_other
        • spacr.qt.i18n_module_summaries_west
        • spacr.qt.iconset
        • spacr.qt.imagery
        • spacr.qt.ingest_preview
        • spacr.qt.job_runner
        • spacr.qt.layer_viewer
        • spacr.qt.linked_selection
        • spacr.qt.logging_util
        • spacr.qt.mask_engine
        • spacr.qt.maturity
        • spacr.qt.multi_format
        • spacr.qt.notify
        • spacr.qt.ortho_view
        • spacr.qt.plate_queue
        • spacr.qt.preferences
        • spacr.qt.prefs
        • spacr.qt.prerun
        • spacr.qt.preview_registry
        • spacr.qt.recipes
        • spacr.qt.regex_detect
        • spacr.qt.regex_editor
        • spacr.qt.resource_cleanup
        • spacr.qt.roi_tool
        • spacr.qt.screens
          • spacr.qt.screens.agreement
          • spacr.qt.screens.align
          • spacr.qt.screens.annotate
          • spacr.qt.screens.app_screen
          • spacr.qt.screens.batch
          • spacr.qt.screens.classifier_evaluation
          • spacr.qt.screens.control_chart
          • spacr.qt.screens.convert
          • spacr.qt.screens.curate
          • spacr.qt.screens.data_manager
          • spacr.qt.screens.db_browser
          • spacr.qt.screens.distributed_jobs
          • spacr.qt.screens.dose_response
          • spacr.qt.screens.experiment_design
          • spacr.qt.screens.feature_explorer
          • spacr.qt.screens.foreign
          • spacr.qt.screens.gate_editor
          • spacr.qt.screens.graph_builder
          • spacr.qt.screens.hit_list
          • spacr.qt.screens.hyperparam
          • spacr.qt.screens.image_scatter
          • spacr.qt.screens.lineage
          • spacr.qt.screens.make_masks
          • spacr.qt.screens.methods_export
          • spacr.qt.screens.model_compare
          • spacr.qt.screens.model_zoo
          • spacr.qt.screens.napari_bridge
          • spacr.qt.screens.outliers
          • spacr.qt.screens.pca
          • spacr.qt.screens.pipeline_graph
          • spacr.qt.screens.plate_view
          • spacr.qt.screens.power
          • spacr.qt.screens.profiler
          • spacr.qt.screens.project_browser
          • spacr.qt.screens.qc_dashboard
          • spacr.qt.screens.queue
          • spacr.qt.screens.report
          • spacr.qt.screens.run_compare
          • spacr.qt.screens.run_history
          • spacr.qt.screens.settings_model
          • spacr.qt.screens.tabulate
          • spacr.qt.screens.train_compare
          • spacr.qt.screens.trellis
        • spacr.qt.settings_diff
        • spacr.qt.settings_search
        • spacr.qt.shortcuts
        • spacr.qt.space
        • spacr.qt.synthetic
        • spacr.qt.theme
        • spacr.qt.verbose_logger
        • spacr.qt.walkthrough
        • spacr.qt.widgets
          • spacr.qt.widgets.activity_spinner
          • spacr.qt.widgets.ai_chat_panel
          • spacr.qt.widgets.ai_toggle_label
          • spacr.qt.widgets.ambient
          • spacr.qt.widgets.animation_zoom
          • spacr.qt.widgets.barcode_regex
          • spacr.qt.widgets.card
          • spacr.qt.widgets.column_picker
          • spacr.qt.widgets.console_panel
          • spacr.qt.widgets.control_chart
          • spacr.qt.widgets.data_filter_panel
          • spacr.qt.widgets.divider
          • spacr.qt.widgets.dna_rain
          • spacr.qt.widgets.dna_rain_settings
          • spacr.qt.widgets.dose_response
          • spacr.qt.widgets.dot_link
          • spacr.qt.widgets.drawer
          • spacr.qt.widgets.eliding
          • spacr.qt.widgets.empty_state
          • spacr.qt.widgets.external_mask_inputs
          • spacr.qt.widgets.feature_dictionary
          • spacr.qt.widgets.feature_explorer
          • spacr.qt.widgets.feature_rank
          • spacr.qt.widgets.field_fade
          • spacr.qt.widgets.figure_queue
          • spacr.qt.widgets.formula
          • spacr.qt.widgets.formula_editor
          • spacr.qt.widgets.gate_editor
          • spacr.qt.widgets.gate_spec
          • spacr.qt.widgets.graph_builder
          • spacr.qt.widgets.graph_spec
          • spacr.qt.widgets.home
          • spacr.qt.widgets.hover_tooltip
          • spacr.qt.widgets.info_link
          • spacr.qt.widgets.live_preview
          • spacr.qt.widgets.measure_preview
          • spacr.qt.widgets.metadata_table
          • spacr.qt.widgets.motility_preview
          • spacr.qt.widgets.outlier_model
          • spacr.qt.widgets.pca_model
          • spacr.qt.widgets.pca_view
          • spacr.qt.widgets.pivot_builder
          • spacr.qt.widgets.pivot_spec
          • spacr.qt.widgets.plate_layout
          • spacr.qt.widgets.power_design
          • spacr.qt.widgets.preview_controls
          • spacr.qt.widgets.qc_summary
          • spacr.qt.widgets.row_exclusion
          • spacr.qt.widgets.section
          • spacr.qt.widgets.tile
          • spacr.qt.widgets.timelapse_preview
          • spacr.qt.widgets.toggle
          • spacr.qt.widgets.trellis_spec
          • spacr.qt.widgets.trellis_view
          • spacr.qt.widgets.umap_explorer
          • spacr.qt.widgets.usage_bar
      • spacr.regression_qc
      • spacr.remote_execution
      • spacr.report
      • spacr.resume
      • spacr.roi
      • spacr.row_exclusions
      • spacr.run_compare
      • spacr.run_journal
      • spacr.runctx
      • spacr.schema
      • spacr.seg_qc
      • spacr.selection
      • spacr.sequencing
      • spacr.sequencing_qc
      • spacr.setting_animations
      • spacr.settings
      • spacr.settings_spec
      • spacr.sim
      • spacr.sp_stats
      • spacr.spacr_cellpose
      • spacr.spacrops
      • spacr.submodules
      • spacr.tiff_io
      • spacr.timelapse
      • spacr.torch_artifacts
      • spacr.toxo
      • spacr.train_compare
      • spacr.umap_annotations
      • spacr.updater
      • spacr.utils
      • spacr.validate
      • spacr.version
      • spacr.zstack
    • parts
    • common
    • render
    • variants
Back to top
View this page
Edit this page

Resumable multi-objective UMAP search¶

Image UMAP can search n_neighbors and min_dist using one criterion or a multi-objective mode. Open UMAP settings… from the Hyperparameter Search panel and choose multi_objective as the criterion.

Why several objectives?¶

No score proves that a UMAP contains biologically meaningful structure. The multi-objective mode therefore retains three separate measurements:

neighborhood_preservation

The geometric mean of trustworthiness and continuity. Trustworthiness penalizes neighbours invented by the two-dimensional embedding; continuity penalizes true feature-space neighbours that the embedding tears apart. Requiring both prevents either failure from being hidden.

stability

The mean fraction of nearest neighbours shared by embeddings fitted with different reproducible seeds. It is invariant to rotations and reflections. A visually striking feature that disappears between repeats is not stable structure.

cluster_structure

Positive silhouette structure on a scale from zero to one. When labels are supplied through the Python API they define the partition. Otherwise spaCR fits reproducible K-means partitions from 2 through 8 clusters and reports the strongest silhouette together with the selected cluster counts. This is evidence of geometric structure, not proof that a cluster is biological.

The three weights are normalized to sum to one. Their weighted geometric mean is called multi_objective and guides the grid or adaptive search. The geometric mean penalizes a collapsed objective more strongly than an arithmetic average.

Pareto front¶

The composite score is not presented as the only answer. spaCR also marks the Pareto front in the result table. A configuration is Pareto-optimal when no other tested configuration improves one objective without making another worse. Inspect the embedding panels and objective tooltips for every non-dominated row before propagating a configuration.

The neighborhood, stability and cluster objectives, normalized weights, repeat count, raw silhouette, cluster source and discovered cluster counts are stored in each trial’s extra_metrics.

Repeated fits and runtime¶

stability repeats controls how many seeded embeddings are fitted per configuration. The minimum is 2 and the default is 3. Runtime scales roughly as:

configurations × stability repeats × one UMAP fit

Use three repeats for routine searches and increase the count when the leading Pareto configurations have similar stability or when a final analysis must be especially reproducible.

Adaptive search and stopping¶

Adaptive 2×2 mode evaluates the four diagonal corners around the current n_neighbors/min_dist centre. The weighted multi-objective score chooses the direction of the next move. Search stops at the maximum round count, when a round fails to exceed minimum improvement, or after Stop is requested. A stopped result is explicitly marked partial.

Resume behavior¶

Enable Resume checkpoint to continue from results/.spacr_checkpoints/umap_search.json under the current project (or from an explicit checkpoint_path in the Python API). Each completed trial is written atomically and its primary embedding is stored beside the JSON. An interrupted adaptive round evaluates only missing corners before choosing a direction.

Resume refuses to combine incompatible work. Feature and label hashes, search space, criterion, seed, neighborhood size, adaptive increments, stopping threshold, stability repeat count, objective weights and embedder identity must match the checkpoint.

Python API¶

Use spacr.hyperparam.umap_search() for a full search, spacr.hyperparam.umap_objective_scores() to score repeated embeddings, spacr.hyperparam.embedding_stability() for stability alone, and spacr.hyperparam.SearchResult.pareto_front() to retrieve non-dominated trials.

from spacr.hyperparam import SearchSpace, umap_search

result = umap_search(
    features,
    SearchSpace({"n_neighbors": [5, 15, 50], "min_dist": [0.05, 0.2]}),
    metric="multi_objective",
    stability_repeats=3,
    objective_weights={
        "neighborhood_preservation": 0.4,
        "stability": 0.3,
        "cluster_structure": 0.3,
    },
    checkpoint_path="results/.spacr_checkpoints/umap_search.json",
    resume=True,
)
for trial in result.pareto_front():
    print(trial.params, trial.extra_metrics)
Next
Remote and distributed execution
Previous
Classifier evaluation workbench
Copyright © 2025-2026, Einar Birnir Olafsson
Made with Sphinx and @pradyunsg's Furo
On this page
  • Resumable multi-objective UMAP search
    • Why several objectives?
    • Pareto front
    • Repeated fits and runtime
    • Adaptive search and stopping
    • Resume behavior
    • Python API