code: def div_safe(numerator, denominator):
      """
      Ufunc-extension that returns 0 instead of nan when dividing numpy arrays
  
      Parameters
      ----------
      numerator: array-like
  
      denominator: scalar or array-like that can be validly divided by the numerator
  
      returns a numpy array
  
      example: div_safe( [-1, 0, 1], 0 ) == [0, 0, 0]
      """
      # First handle scalars
      if np.isscalar(numerator):
          raise ValueError(
              "div_safe should only be used with an array-like numerator"
          )
  
      # Then numpy arrays
      try:
          with np.errstate(divide="ignore", invalid="ignore"):
              result = np.true_divide(numerator, denominator)
              result[~np.isfinite(result)] = 0  # -inf inf NaN
          return result
      except ValueError as e:
          raise e
  
file_path: yellowbrick/yellowbrick/utils/helpers.py
imports: import re
  import inspect
  import sklearn
  import numpy
  from sklearn.pipeline import Pipeline
  from sklearn.utils.validation import check_is_fitted
  from yellowbrick.utils.types import is_estimator
  from yellowbrick.exceptions import YellowbrickTypeError
  from yellowbrick.contrib.wrapper import ContribEstimator
label_desc: Use image node_id 7 for calling a global function with example usage: div_safe(numerator, denominator) and returns: result