code: def preprocess_focusE_weights(data, weights, normalize=True):
      """Preprocessing of focusE weights.
  
      Extract weights from data, remove `NaNs`, average weights and normalize them
      if ``self.focusE_params['normalize_numeric_values']==True``.
  
      Parameters
      ----------
      data: array-like, shape (n,m)
          Array of shape (n,m) with :math:`m=4`. If ``weights=None``, data contains triples
          and weights (:math:`m>3`). If ``weights`` is passed, ``data`` only contains triples (:math:`m=3`).
      weights: array-like
          If not `None`, ``weights`` has shape (n, m-3), with m>0.
      normalize : bool
          Specify whether to normalize the weights into the [0,1] range (default: `True`).
  
      Returns
      -------
      processed_weights: np.array, shape (n, 1)
          An array of weights properly preprocessed and averaged into a unique vector if more than one vector of
          weights were given.
      """
      if weights.ndim == 1:
          weights = weights.reshape(-1, 1)
      logger.debug("focusE normalizing weights")
      unique_relations = np.unique(data[:, 1])
      for reln in unique_relations:
          for col_idx in range(weights.shape[1]):
              # here nans signify unknown numeric values
              suma = np.sum(
                  pd.isna(weights[data[:, 1] == reln, col_idx])
              )
              if suma != weights[data[:, 1] == reln, col_idx].shape[0]:
                  min_val = np.nanmin(
                      weights[data[:, 1] == reln, col_idx].astype(
                          np.float32
                      )
                  )
                  max_val = np.nanmax(
                      weights[data[:, 1] == reln, col_idx].astype(
                          np.float32
                      )
                  )
                  if min_val == max_val:
                      weights[data[:, 1] == reln, col_idx] = 1.0
                      continue
                  # Normalization of the weights
                  if normalize:
                      val = (
                          weights[data[:, 1] == reln, col_idx].astype(
                              float
                          )
                          - min_val
                      ) / (max_val - min_val)
                      weights[data[:, 1] == reln, col_idx] = val
              else:
                  pass  # all the weights are nans
      weights = np.mean(weights, axis=1).reshape(-1, 1)
      return weights
  
file_path: AmpliGraph/ampligraph/utils/model_utils.py
imports: import glob
  import logging
  import os
  import pickle
  import shutil
  from time import gmtime, strftime
  import numpy
  import pandas
  import tensorflow
  from tensorboard.plugins import projector
label_desc: Use image node_id 6 for calling a global function with example usage: preprocess_focusE_weights(data, weights, normalize) and returns: weights