class_docstr: A class containing functions supporting quantile, poisson and gaussian regression, to be used as a mixin for some
  `RegressionModel` subclasses.
class_docstr_tok: ["A","class","containing","functions","supporting","quantile",",","poisson","and","gaussian","regression",",","to","be","used","as","a","mixin","for","some","`","RegressionModel","`","subclasses","."]
docstr: Sample uniformly between [0, 1] (for each batch example) and return the linear interpolation between the fitted
  quantiles closest to the sampled value.
  
  model_output is of shape (n_series * n_samples, output_chunk_length, n_components, n_quantiles)
docstr_tok: ["Sample","uniformly","between","[","0",",","1","]","(","for","each","batch","example",")","and","return","the","linear","interpolation","between","the","fitted","quantiles","closest","to","the","sampled","value",".","model_output","is","of","shape","(","n_series","*","n_samples",",","output_chunk_length",",","n_components",",","n_quantiles",")"]
code: def _sampling_quantile(self, model_output: np.ndarray) -> np.ndarray:
      """
      Sample uniformly between [0, 1] (for each batch example) and return the linear interpolation between the fitted
      quantiles closest to the sampled value.
  
      model_output is of shape (n_series * n_samples, output_chunk_length, n_components, n_quantiles)
      """
      k, n_timesteps, n_components, n_quantiles = model_output.shape
  
      # obtain samples
      probs = self._rng.uniform(
          size=(
              k,
              n_timesteps,
              n_components,
              1,
          )
      )
  
      # add dummy dim
      probas = np.expand_dims(probs, axis=-2)
  
      # tile and transpose
      p = np.tile(probas, (1, 1, 1, n_quantiles, 1)).transpose(
          (0, 1, 2, 4, 3)
      )
  
      # prepare quantiles
      tquantiles = np.array(self.quantiles).reshape((1, 1, 1, -1))
  
      # calculate index of the largest quantile smaller than the sampled value
      left_idx = np.sum(p > tquantiles, axis=-1)
  
      # obtain index of the smallest quantile larger than the sampled value
      right_idx = left_idx + 1
  
      # repeat the model output on the edges
      repeat_count = [1] * n_quantiles
      repeat_count[0] = 2
      repeat_count[-1] = 2
      repeat_count = np.array(repeat_count)
      shifted_output = np.repeat(model_output, repeat_count, axis=-1)
  
      # obtain model output values corresponding to the quantiles left and right of the sampled value
      left_value = np.take_along_axis(shifted_output, left_idx, axis=-1)
      right_value = np.take_along_axis(
          shifted_output, right_idx, axis=-1
      )
  
      # add 0 and 1 to quantiles
      ext_quantiles = [0.0] + self.quantiles + [1.0]
      expanded_q = np.tile(np.array(ext_quantiles), left_idx.shape)
  
      # calculate closest quantiles to the sampled value
      left_q = np.take_along_axis(expanded_q, left_idx, axis=-1)
      right_q = np.take_along_axis(expanded_q, right_idx, axis=-1)
  
      # linear interpolation
      weights = (probs - left_q) / (right_q - left_q)
      inter = left_value + weights * (right_value - left_value)
  
      # shape (n_series * n_samples, output_chunk_length, n_components * n_quantiles)
      return inter.squeeze(-1)
  
imports: from collections import OrderedDict
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  from sklearn.linear_model import LinearRegression
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from darts.models.forecasting.forecasting_model import GlobalForecastingModel
  from darts.timeseries import TimeSeries
  from darts.utils.data.tabularization import add_static_covariates_to_lagged_data, create_lagged_component_names, create_lagged_training_data
  from darts.utils.historical_forecasts import _check_optimizable_historical_forecasts_global_models, _optimized_historical_forecasts_all_points, _optimized_historical_forecasts_last_points_only, _process_historical_forecast_input
  from darts.utils.multioutput import MultiOutputRegressor
  from darts.utils.utils import _check_quantiles, get_single_series, seq2series, series2seq
label_desc: Use image node_id 8 for calling the _LikelihoodMixin obj's underlying member method code with example usage: obj._sampling_quantile(model_output) and returns: inter