code: def lightweight_coreset(x, x_mean, n, normalized=False, proba=None):
      """Computes a lightweight coreset [BLK18]_ of `x` with size `n`.
  
      Parameters
      ----------
      x : np.ndarray
          2D array in which each row represents a sample.
      x_mean : np.ndarray
          Elementwise mean over the columns of `x`.
      n : int
          Coreset size.
      normalized : bool
          If `True` the data `x` is assumed to be normalized,
          otherwise it will be normalized where necessary.
      proba : np.ndarray or None
          A probability distribution over `x`, which makes up half of the probability mass
          of the sampling distribution. If `proba` is not `None` a uniform distribution is used.
  
      Returns
      -------
      indices : numpy.ndarray
          Indices relative to `x`.
      """
      _check_coreset_size(x, n)
  
      sim = x.dot(x_mean)
      if not normalized:
          sim = sim / (
              np.linalg.norm(x, axis=1) * np.linalg.norm(x_mean)
          )
  
      dists = np.arccos(sim) / np.pi
      dists = np.square(dists)
  
      sum_dists = dists.sum()
  
      if proba is None:
          uniform = 0.5 * 1 / x.shape[0]
          proba = uniform + 0.5 * dists / sum_dists
      else:
          proba = 0.5 * proba / proba.sum() + 0.5 * dists / sum_dists
  
      proba = proba / np.linalg.norm(proba, ord=1)
  
      return np.random.choice(
          np.arange(x.shape[0]), n, replace=False, p=proba
      )
  
file_path: small-text/small_text/query_strategies/coresets.py
imports: import warnings
  import numpy
  from sklearn.metrics import pairwise_distances
  from small_text.query_strategies.strategies import EmbeddingBasedQueryStrategy
label_desc: Use image node_id 5 for calling a global function with example usage: lightweight_coreset(x, x_mean, n, normalized, proba) and returns: np