class_docstr: Class for building prediction intervals based on Fedot functionality.
  
  Args:
      model: a fitted Fedot class object for times series forecasting task
      horizon: horizon for ts forecasting
      nominal_error: nominal error for prediction intervals task
      method: general method for creating forecasts. Possible options:
  
           - 'last_generation_ql' -> a number of pipelines from the last generation is fitted using
              quantile loss/pinball loss metric.
           - 'best_pipelines_quantiles' -> prediction intervals are computed based on predictions of all
              pipelines in last generation
           - 'mutation_of_best_pipeline' -> prediction intervals are built relying on mutations of the final
              pipeline
  
      params: params for building prediction intervals.
class_docstr_tok: ["Class","for","building","prediction","intervals","based","on","Fedot","functionality",".","Args",":","model",":","a","fitted","Fedot","class","object","for","times","series","forecasting","task","horizon",":","horizon","for","ts","forecasting","nominal_error",":","nominal","error","for","prediction","intervals","task","method",":","general","method","for","creating","forecasts",".","Possible","options",":","-","'last_generation_ql","'","-",">","a","number","of","pipelines","from","the","last","generation","is","fitted","using","quantile","loss\/pinball","loss","metric",".","-","'best_pipelines_quantiles","'","-",">","prediction","intervals","are","computed","based","on","predictions","of","all","pipelines","in","last","generation","-","'mutation_of_best_pipeline","'","-",">","prediction","intervals","are","built","relying","on","mutations","of","the","final","pipeline","params",":","params","for","building","prediction","intervals","."]
docstr: This method builds prediction intervals based on the output of method 'fit'.
  
  Args:
      regime (str): a way to compute prediction intervals if argument 'method' is 'last_generation_ql'.
  
  Returns:
      dictionary of upper and low prediction intervals.
docstr_tok: ["This","method","builds","prediction","intervals","based","on","the","output","of","method","'fit","'",".","Args",":","regime","(","str",")",":","a","way","to","compute","prediction","intervals","if","argument","'method","'","is","'last_generation_ql","'",".","Returns",":","dictionary","of","upper","and","low","prediction","intervals","."]
code: def forecast(self, regime: str = "quantile"):
      """This method builds prediction intervals based on the output of method 'fit'.
  
      Args:
          regime (str): a way to compute prediction intervals if argument 'method' is 'last_generation_ql'.
  
      Returns:
          dictionary of upper and low prediction intervals.
      """
      if not self.is_fitted:
          raise ValueError(
              "PredictionIntervals instance is not fitted! Fit the instance first."
          )
  
      if self.method == "last_generation_ql":
          quantiles_up = compute_prediction_intervals(
              self.up_predictions, nominal_error=self.nominal_error
          )
          quantiles_low = compute_prediction_intervals(
              self.low_predictions, nominal_error=self.nominal_error
          )
  
          up_int = quantiles_up[self.regime_up[regime]]
          low_int = quantiles_low[self.regime_low[regime]]
  
      elif self.method in [
          "best_pipelines_quantiles",
          "mutation_of_best_pipeline",
      ]:
          quantiles = compute_prediction_intervals(
              self.all_predictions, nominal_error=self.nominal_error
          )
          up_int = quantiles["quantile_up"]
          low_int = quantiles["quantile_low"]
  
      self.up_int = np.maximum(up_int, self.model_forecast)
      self.low_int = np.minimum(low_int, self.model_forecast)
  
      self.is_forecasted = True
  
      return {"up_int": self.up_int, "low_int": self.low_int}
  
file_path: FEDOT/fedot/core/pipelines/prediction_intervals/main.py
imports: from functools import partial
  from typing import Optional
  import numpy
  from golem.core.log import default_log, Log
  from fedot import Fedot
  from fedot.core.data.data import InputData
  from fedot.core.pipelines.prediction_intervals.params import PredictionIntervalsParams
  from fedot.core.pipelines.prediction_intervals.solvers.best_pipelines_quantiles import solver_best_pipelines_quantiles
  from fedot.core.pipelines.prediction_intervals.solvers.last_generation_quantile_loss import solver_last_generation_ql
  from fedot.core.pipelines.prediction_intervals.solvers.mutation_of_best_pipeline import solver_mutation_of_best_pipeline
  from fedot.core.pipelines.prediction_intervals.utils import compute_prediction_intervals, get_base_quantiles, check_init_params, get_last_generations
  from fedot.core.pipelines.prediction_intervals.visualization import plot_prediction_intervals, _plot_prediction_intervals
label_desc: Use image node_id 3 for calling the PredictionIntervals obj's underlying member method code with example usage: obj.forecast(regime) and returns: dict