class_docstr: The quantile regression based uncertainty model.
  Predicts quantiles as the prediction intervals.
  The quantiles are calculated based on the ``coverage`` parameter.
  For example, a 90% prediction interval is the 0.05 quantile and 0.95 quantile predictions.
  
  There are four scenarios:
  
      - ``is_residual_based = False`` and ``x_mat`` is provided.
        In this case, the method fits two quantile regression models based on the ``value_col`` and ``x_mat``.
        Depending on the forecast model, the generated prediction intervals may not cover the forecasted values.
      - ``is_residual_based = False`` and ``x_mat`` is not provided.
        In this case, a ``x_mat`` is generated based on ``time_col``
        including linear growth and yearly/weekly seasonality.
        Currently we do not support customizing the generation of this feature matrix.
        The method fits two quantile regression models based on ``value_col`` and the generated ``x_mat``.
        Depending on the forecast model, the generated prediction intervals may not cover the forecasted values.
      - ``is_residual_based = True`` and ``x_mat`` is provided.
        In this case, the ``predicted_col`` needs to be provided
        in addition to ``value_col`` to calculate the residuals.
        The method fits two quantile regression models based on the residuals and ``x_mat``.
        The fitted residual quantiles are added to the forecasted values.
      - ``is_residual_based = True`` and ``x_mat`` is not provided.
        In this case, the ``predicted_col`` needs to be provided
        in addition to ``value_col`` to calculate the residuals.
        In this case, a ``x_mat`` is generated based on ``time_col``
        including linear growth and yearly/weekly seasonality.
        Currently we do not support customizing the generation of this feature matrix.
        The method fits two quantile regression models based on residuals and the generated ``x_mat``.
        The fitted residual quantiles are added to the forecasted values.
  
  If ``x_mat`` is not provided, ``time_col`` must be provided to build the feature matrix.
  
  If ``is_residual_based = False``, then ``value_col`` must be provided to train the model.
  If ``is_residual_based = True``, then both ``value_col`` and ``predicted_col`` must be provided.
  In this case, the method also tries to find ``cst.PREDICTED_COL`` in the training data
  too if ``predicted_col`` is not provided.
  
  Attributes
  ----------
  uncertainty_dict : `dict` [`str`, any]
      The uncertainty model specification. It should have the following keys:
  
              "uncertainty_method": a string that is in
                  `~greykite.sklearn.uncertainty.uncertainty_methods.UncertaintyMethodEnum`.
              "params": a dictionary that includes any additional parameters needed by the uncertainty method.
                        Expected keys include: "value_col", "predicted_col", "is_residual_based"
                        and "quantiles".
  
  UNCERTAINTY_METHOD : `str`
      The name for the uncertainty method.
  REQUIRED_PARAMS : `list` [`str`]
      A list of required parameters for the method.
  coverage : `float`
      The coverage of the uncertainty intervals.
      Will be used to calculate the quantiles.
  time_col : `str`
      The column name for timestamps in ``train_df`` and ``fut_df``.
  value_col : `str` or None
      The column name for values in ``train_df`` and ``fut_df``.
  predicted_col : `str` or None
      The column name for predicted values in ``train_df`` and ``fut_df``.
  residual_col : `str` or None
      The column name for residuals in ``train_df``.
  quantiles : `list` [`float`] or None
      A list of quantiles to be fitted.
      This is also derived from the ``coverage`` parameter.
  is_residual_based : `bool` or None
      Whether to fit the original values or residuals.
  models : `list` [`QuantileRegression`] or None
      A list of trained quantile regression models.
  x_mat : `pandas.DataFrame` or None
      The feature matrix used to fit the model.
  build_x_mat : `bool` or None
      Whether the feature matrix is built. If False, it is provided.
  distribution_col : `str` or None
      The column name for the column used as response in fitting the quantile regression models.
  offset_col : `str` or None
      The column name for the column used to offset the predicted intervals.
docstr: Builds a default ``self.x_mat`` if it is not given.
  Currently the class does not support customizing the built feature matrix.
  
  The built matrix has the following components:
  
      - growth: linear
      - seasonality: yearly/weekly
  
  Parameters
  ----------
  training_phase : `bool`, default True
      Whether it's training phase or prediction phase.
      For training phase, it uses ``self.train_df``.
  fut_df : `pandas.DataFrame` or None, default None
      If ``training_phase`` is False, this must be provided.
      Used to build the feature matrix.
      Includes the ``time_col`` to build features.
  
  Returns
  -------
  x_mat : `pandas.DataFrame`
      The feature matrix.
docstr_tok: ["Builds","a","default","``","self.x_mat","``","if","it","is","not","given",".","Currently","the","class","does","not","support","customizing","the","built","feature","matrix",".","The","built","matrix","has","the","following","components",":","-","growth",":","linear","-","seasonality",":","yearly\/weekly","Parameters","--","--","--","--","--","training_phase",":","`","bool","`",",","default","True","Whether","it","'s","training","phase","or","prediction","phase",".","For","training","phase",",","it","uses","``","self.train_df","``",".","fut_df",":","`","pandas.DataFrame","`","or","None",",","default","None","If","``","training_phase","``","is","False",",","this","must","be","provided",".","Used","to","build","the","feature","matrix",".","Includes","the","``","time_col","``","to","build","features",".","Returns","--","--","--","-","x_mat",":","`","pandas.DataFrame","`","The","feature","matrix","."]
code: def _build_quantile_regression_features(
      self,
      training_phase: bool = True,
      fut_df: Optional[pd.DataFrame] = None,
  ) -> pd.DataFrame:
      """Builds a default ``self.x_mat`` if it is not given.
      Currently the class does not support customizing the built feature matrix.
  
      The built matrix has the following components:
  
          - growth: linear
          - seasonality: yearly/weekly
  
      Parameters
      ----------
      training_phase : `bool`, default True
          Whether it's training phase or prediction phase.
          For training phase, it uses ``self.train_df``.
      fut_df : `pandas.DataFrame` or None, default None
          If ``training_phase`` is False, this must be provided.
          Used to build the feature matrix.
          Includes the ``time_col`` to build features.
  
      Returns
      -------
      x_mat : `pandas.DataFrame`
          The feature matrix.
      """
      columns = ["ct1"]
      if training_phase:
          df = self.train_df[[self.time_col]].copy()
      else:
          if fut_df is None:
              raise UncertaintyError(
                  "Creating quantile regression feature matrix for future phase "
                  "requires `fut_df`."
              )
          df = fut_df[[self.time_col]].copy()
  
      # Includes yearly/weekly seasonality features.
      fs_components_df = pd.DataFrame(
          {
              "name": [
                  cst.TimeFeaturesEnum.tow.value,
                  cst.TimeFeaturesEnum.toy.value,
              ],
              "period": [7.0, 1.0],
              "order": [4, 10],
              "seas_names": ["weekly", "yearly"],
          }
      )
      fs_func = fourier_series_multi_fcn(
          col_names=fs_components_df.get("name"),
          periods=fs_components_df.get("period"),
          orders=fs_components_df.get("order"),
          seas_names=fs_components_df.get("seas_names"),
      )
      # Gets the fourier columns
      fs_cols = get_fourier_feature_col_names(
          df=df, time_col=self.time_col, fs_func=fs_func
      )
      columns += fs_cols
  
      silverkite = SilverkiteForecast()
      x_mat = silverkite._SilverkiteForecast__build_silverkite_features(
          df=df,
          time_col=self.time_col,
          origin_for_time_vars=get_default_origin_for_time_vars(
              df=self.train_df[[self.time_col]].copy(),
              time_col=self.time_col,
          ),
          continuous_time_col="ct1",
          growth_func=lambda x: x,
          fs_func=fs_func,
      )
      return x_mat[columns]
  
imports: from __future__ import annotations
  from typing import Dict
  from typing import List
  from typing import Optional
  import pandas
  from sklearn.exceptions import NotFittedError
  from greykite.algo.common.l1_quantile_regression import QuantileRegression
  from greykite.algo.forecast.silverkite.forecast_silverkite import SilverkiteForecast
  from greykite.algo.forecast.silverkite.forecast_silverkite_helper import get_fourier_feature_col_names
  from greykite.algo.forecast.silverkite.forecast_silverkite_helper import get_silverkite_uncertainty_dict
  from greykite.common import constants
  from greykite.common.features.timeseries_features import fourier_series_multi_fcn
  from greykite.common.features.timeseries_features import get_default_origin_for_time_vars
  from greykite.sklearn.uncertainty.base_uncertainty_model import BaseUncertaintyModel
  from greykite.sklearn.uncertainty.exceptions import UncertaintyError
label_desc: Use image node_id 3 for calling the QuantileRegressionUncertaintyModel obj's underlying member method code with example usage: obj._build_quantile_regression_features(training_phase, fut_df) and returns: x_mat