code: def _fit_embed_data(self, X, n_epochs, init, random_state):
      if self.metric == "precomputed":
          X = self._X
  
      # get dimensionality of dataset
      if self.dims is None:
          self.dims = [np.shape(X)[-1]]
      else:
          # reshape data for network
          if len(self.dims) > 1:
              X = np.reshape(X, [len(X)] + list(self.dims))
  
      if self.parametric_reconstruction and (
          np.max(X) > 1.0 or np.min(X) < 0.0
      ):
          warn(
              "Data should be scaled to the range 0-1 for cross-entropy reconstruction loss."
          )
  
      # get dataset of edges
      (
          edge_dataset,
          self.batch_size,
          n_edges,
          head,
          tail,
          self.edge_weight,
      ) = construct_edge_dataset(
          X,
          self.graph_,
          self.n_epochs,
          self.batch_size,
          self.parametric_embedding,
          self.parametric_reconstruction,
          self.global_correlation_loss_weight,
      )
      self.head = tf.constant(tf.expand_dims(head.astype(np.int64), 0))
      self.tail = tf.constant(tf.expand_dims(tail.astype(np.int64), 0))
  
      if self.parametric_embedding:
          init_embedding = None
      else:
          init_embedding = init_embedding_from_graph(
              X,
              self.graph_,
              self.n_components,
              self.random_state,
              self.metric,
              self._metric_kwds,
              init="spectral",
          )
  
      # create encoder and decoder model
      n_data = len(X)
      self.encoder, self.decoder = prepare_networks(
          self.encoder,
          self.decoder,
          self.n_components,
          self.dims,
          n_data,
          self.parametric_embedding,
          self.parametric_reconstruction,
          init_embedding,
      )
  
      # create the model
      self._define_model()
      self._compile_model()
  
      # report every loss_report_frequency subdivision of an epochs
      if self.parametric_embedding:
          steps_per_epoch = int(
              n_edges / self.batch_size / self.loss_report_frequency
          )
      else:
          # all edges are trained simultaneously with nonparametric, so this is arbitrary
          steps_per_epoch = 100
  
      # Validation dataset for reconstruction
      if (
          self.parametric_reconstruction
          and self.reconstruction_validation is not None
      ):
          # reshape data for network
          if len(self.dims) > 1:
              self.reconstruction_validation = np.reshape(
                  self.reconstruction_validation,
                  [len(self.reconstruction_validation)]
                  + list(self.dims),
              )
  
          validation_data = (
              (
                  self.reconstruction_validation,
                  tf.zeros_like(self.reconstruction_validation),
              ),
              {"reconstruction": self.reconstruction_validation},
          )
      else:
          validation_data = None
  
      # create embedding
      history = self.parametric_model.fit(
          edge_dataset,
          epochs=self.loss_report_frequency * self.n_training_epochs,
          steps_per_epoch=steps_per_epoch,
          max_queue_size=100,
          validation_data=validation_data,
          **self.keras_fit_kwargs,
      )
      # save loss history dictionary
      self._history = history.history
  
      # get the final embedding
      if self.parametric_embedding:
          embedding = self.encoder.predict(X, verbose=self.verbose)
      else:
          embedding = self.encoder.trainable_variables[0].numpy()
  
      return embedding, {}
  
imports: import numpy
  from umap import UMAP
  from warnings import warn, catch_warnings, filterwarnings
  from numba import TypingError
  import os
  from umap.spectral import spectral_layout
  from sklearn.utils import check_random_state
  import codecs, pickle
  from sklearn.neighbors import KDTree
  import sys
label_desc: Use image node_id 8 for calling the ParametricUMAP obj's underlying member method code with example usage: obj._fit_embed_data(X, n_epochs, init, random_state) and returns: embedding,  dict