class_docstr: The simple conditional residuals uncertainty model.
  For more details, see `~greykite.algo.uncertainty.conditional.conf_interval`.
  
  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.
  
  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`
      The column name for values in ``train_df`` and ``fut_df``.
  distribution_col : `str` or None
      The column name for the column used to fit the distribution in ``train_df`` and ``fut_df``.
  residual_col : `str` or None
      The column name for residuals in ``train_df``.
  conditional_cols : `list` [`str`]
      The conditional columns when calculating the standard errors of the residuals.
  offset_col : `str` or None
      The column name for the column used to offset predicted intervals.
  is_residual_based : `bool` or None
      Whether to fit the original values or residuals.
class_docstr_tok: ["The","simple","conditional","residuals","uncertainty","model",".","For","more","details",",","see","`","~greykite.algo.uncertainty.conditional.conf_interval","`",".","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",".","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","`","The","column","name","for","values","in","``","train_df","``","and","``","fut_df","``",".","distribution_col",":","`","str","`","or","None","The","column","name","for","the","column","used","to","fit","the","distribution","in","``","train_df","``","and","``","fut_df","``",".","residual_col",":","`","str","`","or","None","The","column","name","for","residuals","in","``","train_df","``",".","conditional_cols",":","`","list","`","[","`","str","`","]","The","conditional","columns","when","calculating","the","standard","errors","of","the","residuals",".","offset_col",":","`","str","`","or","None","The","column","name","for","the","column","used","to","offset","predicted","intervals",".","is_residual_based",":","`","bool","`","or","None","Whether","to","fit","the","original","values","or","residuals","."]
docstr: Predicts the interval.
  
  Parameters
  ----------
  fut_df : `pandas.DataFrame`
      The dataframe used for prediction.
      Must have the following columns:
  
          value_col: the value column.
          PREDICT_COL: if this column exists, it will be used instead of ``value_col``.
  
  Returns
  -------
  result_df : `pandas.DataFrame`
      The ``fut_df`` augmented with prediction intervals.
docstr_tok: ["Predicts","the","interval",".","Parameters","--","--","--","--","--","fut_df",":","`","pandas.DataFrame","`","The","dataframe","used","for","prediction",".","Must","have","the","following","columns",":","value_col",":","the","value","column",".","PREDICT_COL",":","if","this","column","exists",",","it","will","be","used","instead","of","``","value_col","``",".","Returns","--","--","--","-","result_df",":","`","pandas.DataFrame","`","The","``","fut_df","``","augmented","with","prediction","intervals","."]
code: def predict(self, fut_df: pd.DataFrame):
      """Predicts the interval.
  
      Parameters
      ----------
      fut_df : `pandas.DataFrame`
          The dataframe used for prediction.
          Must have the following columns:
  
              value_col: the value column.
              PREDICT_COL: if this column exists, it will be used instead of ``value_col``.
  
      Returns
      -------
      result_df : `pandas.DataFrame`
          The ``fut_df`` augmented with prediction intervals.
      """
      fut_df = fut_df.reset_index(drop=True)
      # Checks ``self.offset_col`` in ``fut_df``.
      if (
          self.offset_col is not None
          and self.offset_col not in fut_df.columns
      ):
          raise UncertaintyError(
              f"The offset column {self.offset_col} is not found in `fut_df`."
          )
      # Records the originals columns to be output.
      output_cols = list(fut_df.columns)
      # Tries to build conditional features based on time column.
      if self.time_col is not None and self.time_col in fut_df:
          fut_df = add_time_features_df(
              df=fut_df,
              time_col=self.time_col,
              conti_year_origin=0,  # this only affects the ``ct`` columns, which are not expected as conditional cols
          )
      elif cst.TIME_COL in fut_df.columns:
          fut_df = add_time_features_df(
              df=fut_df,
              time_col=cst.TIME_COL,
              conti_year_origin=0,  # this only affects the ``ct`` columns, which are not expected as conditional cols
          )
  
      # Predict.
      fut_df = predict_ci(fut_df, self.uncertainty_model)
      fut_df[cst.PREDICTED_LOWER_COL] = fut_df[
          cst.QUANTILE_SUMMARY_COL
      ].str[0]
      fut_df[cst.PREDICTED_UPPER_COL] = fut_df[
          cst.QUANTILE_SUMMARY_COL
      ].str[-1]
      self.pred_df = fut_df
      output_cols += [
          cst.PREDICTED_LOWER_COL,
          cst.PREDICTED_UPPER_COL,
          cst.ERR_STD_COL,
      ]
  
      return fut_df[output_cols]
  
file_path: greykite/greykite/sklearn/uncertainty/simple_conditional_residuals_model.py
imports: from typing import Dict
  from typing import List
  from typing import Optional
  import pandas
  from greykite.algo.forecast.silverkite.forecast_silverkite_helper import get_silverkite_uncertainty_dict
  from greykite.algo.uncertainty.conditional.conf_interval import conf_interval
  from greykite.algo.uncertainty.conditional.conf_interval import predict_ci
  from greykite.common import constants
  from greykite.common.features.timeseries_features import add_time_features_df
  from greykite.sklearn.uncertainty.base_uncertainty_model import BaseUncertaintyModel
  from greykite.sklearn.uncertainty.exceptions import UncertaintyError
label_desc: Use image node_id 4 for calling the SimpleConditionalResidualsModel obj's underlying member method code with example usage: obj.predict(fut_df) and returns: fut_df