code: def xgb_quantile_loss(
      labels: np.ndarray, preds: np.ndarray, quantile: float
  ):
      """Custom loss function for XGBoost to compute quantile loss gradient.
  
      Inspired from: https://gist.github.com/Nikolay-Lysenko/06769d701c1d9c9acb9a66f2f9d7a6c7
  
      This computes the gradient of the pinball loss between predictions and target labels.
      """
      raise_if_not(
          0 <= quantile <= 1,
          "Quantile must be between 0 and 1.",
          logger,
      )
  
      errors = preds - labels
      left_mask = errors < 0
      right_mask = errors > 0
  
      grad = -quantile * left_mask + (1 - quantile) * right_mask
      hess = np.ones_like(preds)
  
      return grad, hess
  
file_path: darts/darts/models/forecasting/xgboost.py
imports: from functools import partial
  from typing import List, Optional, Sequence, Union
  import numpy
  import xgboost
  from darts.logging import get_logger
  from darts.models.forecasting.regression_model import FUTURE_LAGS_TYPE, LAGS_TYPE, RegressionModel, _LikelihoodMixin
  from darts.timeseries import TimeSeries
  from darts.utils.utils import raise_if_not
label_desc: Use image node_id 1 for calling a global function with example usage: xgb_quantile_loss(labels, preds, quantile) and returns: grad,  hess