code: def regression_metrics(
      y, p, w=None, metrics={"RMSE": rmse, "sMAPE": smape, "Gini": gini}
  ):
      """Log metrics for regressors.
  
      Args:
          y (numpy.array): target
          p (numpy.array): prediction
          w (numpy.array, optional): a treatment vector (1 or True: treatment, 0 or False: control). If given, log
              metrics for the treatment and control group separately
          metrics (dict, optional): a dictionary of the metric names and functions
      """
      assert metrics
      assert y.shape[0] == p.shape[0]
  
      for name, func in metrics.items():
          if w is not None:
              assert y.shape[0] == w.shape[0]
              if w.dtype != bool:
                  w = w == 1
              logger.info(
                  "{:>8s}   (Control): {:10.4f}".format(
                      name, func(y[~w], p[~w])
                  )
              )
              logger.info(
                  "{:>8s} (Treatment): {:10.4f}".format(
                      name, func(y[w], p[w])
                  )
              )
          else:
              logger.info("{:>8s}: {:10.4f}".format(name, func(y, p)))
  
file_path: causalml/causalml/metrics/regression.py
imports: import logging
  import numpy
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import r2_score
  from .const import EPS
label_desc: Use image node_id 6 for calling a global function with example usage: regression_metrics(y, p, w, metrics) without return types