class_docstr: UMAP Mixin for automagic UMAPing
class_docstr_tok: ["UMAP","Mixin","for","automagic","UMAPing"]
code: def umap_lazy_init(
      self,
      res,
      n_neighbors: int = 12,
      min_dist: float = 0.1,
      spread: float = 0.5,
      local_connectivity: int = 1,
      repulsion_strength: float = 1,
      negative_sample_rate: int = 5,
      n_components: int = 2,
      metric: str = "euclidean",
      engine: UMAPEngine = "auto",
      suffix: str = "",
      verbose: bool = False,
  ):
      from graphistry.features import ModelDict
  
      engine_resolved = resolve_umap_engine(engine)
      # FIXME remove as set_new_kwargs will always replace?
      if engine_resolved == UMAP_LEARN:
          _, _, umap_engine = lazy_umap_import_has_dependancy()
      elif engine_resolved == CUML:
          _, _, umap_engine = lazy_cuml_import_has_dependancy()
      else:
          raise ValueError(
              "No umap engine, ensure 'auto', 'umap_learn', or 'cuml', and the library is installed"
          )
      umap_kwargs = ModelDict(
          "UMAP Parameters",
          **{
              "n_components": n_components,
              **({"metric": metric} if engine_resolved == UMAP_LEARN else {}),  # type: ignore
              "n_neighbors": n_neighbors,
              "min_dist": min_dist,
              "spread": spread,
              "local_connectivity": local_connectivity,
              "repulsion_strength": repulsion_strength,
              "negative_sample_rate": negative_sample_rate,
          },
      )
  
      if getattr(res, "_umap_params", None) == umap_kwargs:
          print(
              "Same umap params as last time, skipping new init"
          ) if verbose else None
          return res
  
      print("lazy init") if verbose else None
      print(umap_kwargs) if verbose else None
      # set new umap kwargs
      res._umap_params = umap_kwargs
  
      res._n_components = n_components
      res._metric = metric
      res._n_neighbors = n_neighbors
      res._min_dist = min_dist
      res._spread = spread
      res._local_connectivity = local_connectivity
      res._repulsion_strength = repulsion_strength
      res._negative_sample_rate = negative_sample_rate
      res._umap = umap_engine.UMAP(**umap_kwargs)
      res.engine = engine_resolved
      res._suffix = suffix
  
      return res
  
imports: import copy
  from time import time
  from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union
  from inspect import getmodule
  import pandas
  from .None import constants
  from .constants import CUML, UMAP_LEARN
  from .feature_utils import FeatureMixin, Literal, XSymbolic, YSymbolic, prune_weighted_edges_df_and_relabel_nodes, resolve_feature_engine
  from .PlotterBase import Plottable, WeakValueDictionary
  from .util import check_set_memoize
  import logging
label_desc: Use image node_id 2 for calling the UMAPMixin obj's underlying member method code with example usage: obj.umap_lazy_init(res, n_neighbors, min_dist, spread, local_connectivity, repulsion_strength, negative_sample_rate, n_components, metric, engine, suffix, verbose) and returns: res, res