code: def compute_cross_entropy(
      probabilities_graph,
      log_probabilities_distance,
      EPS=1e-4,
      repulsion_strength=1.0,
  ):
      """
      Compute cross entropy between low and high probability
  
      Parameters
      ----------
      probabilities_graph : array
          high dimensional probabilities
      log_probabilities_distance : array
          low dimensional log probabilities
      EPS : float, optional
          offset to ensure log is taken of a positive number, by default 1e-4
      repulsion_strength : float, optional
          strength of repulsion between negative samples, by default 1.0
  
      Returns
      -------
      attraction_term: tf.float32
          attraction term for cross entropy loss
      repellant_term: tf.float32
          repellent term for cross entropy loss
      cross_entropy: tf.float32
          cross entropy umap loss
  
      """
      # cross entropy
      attraction_term = -probabilities_graph * tf.math.log_sigmoid(
          log_probabilities_distance
      )
      # use numerically stable repellent term
      # Shi et al. 2022 (https://arxiv.org/abs/2111.08851)
      # log(1 - sigmoid(logits)) = log(sigmoid(logits)) - logits
      repellant_term = (
          -(1.0 - probabilities_graph)
          * (
              tf.math.log_sigmoid(log_probabilities_distance)
              - log_probabilities_distance
          )
          * repulsion_strength
      )
  
      # balance the expected losses between attraction and repel
      CE = attraction_term + repellant_term
      return attraction_term, repellant_term, CE
  
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 4 for calling a global function with example usage: compute_cross_entropy(probabilities_graph, log_probabilities_distance, EPS, repulsion_strength) and returns: attraction_term,  repellant_term,  CE