docs: def add_regression_events(obj, events, targets, weights=None, test=False):
      """Add regression events to a TMVA::Factory or TMVA::DataLoader from NumPy arrays.
  
      Parameters
      ----------
      obj : TMVA::Factory or TMVA::DataLoader
          A TMVA::Factory or TMVA::DataLoader (TMVA's interface as of ROOT
          6.07/04) instance with variables already
          booked in exactly the same order as the columns in ``events``.
      events : numpy array of shape [n_events, n_variables]
          A two-dimensional NumPy array containing the rows of events and columns
          of variables. The order of the columns must match the order in which
          you called ``AddVariable()`` for each variable.
      targets : numpy array of shape [n_events] or [n_events, n_targets]
          The target value(s) for each event in ``events``. For multiple target
          values, ``targets`` must be a two-dimensional array with a column for
          each target in the same order in which you called ``AddTarget()``.
      weights : numpy array of shape [n_events], optional
          Event weights.
      test : bool, optional (default=False)
          If True, then the events will be added as test events, otherwise they
          are added as training events by default.
  
      Notes
      -----
      A TMVA::Factory or TMVA::DataLoader requires you to add both training and
      test events even if you don't intend to call ``TestAllMethods()``.
  
      """
      if NEW_TMVA_API:  # pragma: no cover
          if not isinstance(obj, TMVA.DataLoader):
              raise TypeError(
                  "obj must be a TMVA.DataLoader "
                  "instance for ROOT >= 6.07/04")
      else:  # pragma: no cover
          if not isinstance(obj, TMVA.Factory):
              raise TypeError(
                  "obj must be a TMVA.Factory instance")
      events = np.ascontiguousarray(events, dtype=np.float64)
      if events.ndim == 1:
          # convert to 2D
          events = events[:, np.newaxis]
      elif events.ndim != 2:
          raise ValueError(
              "events must be a two-dimensional array "
              "with one event per row")
      targets = np.asarray(targets, dtype=np.float64)
      if targets.shape[0] != events.shape[0]:
          raise ValueError("the lengths of events and targets do not match")
      if targets.ndim == 1:
          # convert to 2D
          targets = targets[:, np.newaxis]
      elif targets.ndim > 2:
          raise ValueError("targets can not have more than two dimensions")
      if weights is not None:
          weights = np.asarray(weights, dtype=np.float64)
          if weights.shape[0] != events.shape[0]:
              raise ValueError("numbers of events and weights do not match")
          if weights.ndim != 1:
              raise ValueError("weights must be one-dimensional")
      _libtmvanumpy.add_events_regression(
          ROOT.AsCObject(obj), events, targets, weights, test)