code: def pareto_efficiency_mask(X: npt.NDArray[np.float32]) -> np.ndarray:
      """
      Evaluates for each allocation in the provided array whether it is Pareto
      efficient. The costs are assumed to be improved by lowering them.
  
      Args:
          X: Array of shape [N, D] (N: number of allocations, D: number of costs) containing the
              allocations to check.
  
      Returns:
          A boolean array of shape [N], indicating for each allocation whether it is Pareto
              efficient.
      """
      # First, we assume that all allocations are Pareto efficient, i.e. not dominated
      mask = np.ones(X.shape[0], dtype=bool)
      # Then, we iterate over all allocations A and check which are dominated by then current
      # allocation A. If it is, we don't need to check it against another allocation.
      for i, allocation in enumerate(X):
          # Only consider allocation if it hasn't been dominated yet
          if mask[i]:
              # An allocation is dominated by A if all costs are equal or lower and at least one cost
              # is strictly lower. Using that definition, A cannot be dominated by itself.
              dominated = np.all(
                  allocation <= X[mask], axis=1
              ) * np.any(allocation < X[mask], axis=1)
              mask[mask] = ~dominated
  
      return mask
  
imports: from typing import List, Optional, Union
  import numpy
  import numpy.typing
  import scipy.stats
label_desc: Use image node_id 1 for calling a global function with example usage: pareto_efficiency_mask(X) and returns: mask