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","."]
code: def __init__(
      self,
      model: Fedot,
      horizon: Optional[int] = None,
      nominal_error: float = 0.1,
      method: str = "mutation_of_best_pipeline",
      params: PredictionIntervalsParams = PredictionIntervalsParams(),
  ):
      # check whether PredictionIntervals defined correctly
      check_init_params(model, horizon, nominal_error, method, params)
  
      last_generations = get_last_generations(model)
      self.generation = last_generations["last_generation"]
      self.best_ind = last_generations["final_choice"]
      self.ts = model.train_data.features
  
      self.horizon = (
          horizon or model.params.task.task_params.forecast_length
      )
      self.model_forecast = model.forecast(horizon=self.horizon)
  
      self.nominal_error = nominal_error
      self.method = method
      self.best_pipeline = model.current_pipeline
  
      # setup logger
      Log().reset_logging_level(params.logging_level)
      self.logger = default_log(prefix="PredictionIntervals")
  
      # arrays of auxilary forecasts to build prediction intervals
      self.up_predictions = None
      self.low_predictions = None
      self.all_predictions = None
  
      # prediction intervals
      self.up_int = None
      self.low_int = None
  
      # base quantiles
      self.base_quantiles = None
  
      # flags whether PredictionIntervals instance is fitted/forecasted
      self.is_fitted = False
      self.is_forecasted = False
  
      # flag whether base quantiles are computed
      self.base_quantiles_are_computed = False
  
      # initialize solver for building prediction intervals
      if self.method == "mutation_of_best_pipeline":
          self.solver = partial(
              solver_mutation_of_best_pipeline,
              ind=self.best_ind,
              horizon=self.horizon,
              forecast=self.model_forecast,
              operations=params.mutations_operations,
              number_mutations=params.number_mutations,
              mutations_choice=params.mutations_choice,
              n_jobs=params.n_jobs,
              show_progress=params.show_progress,
              discard_inapropriate_pipelines=params.mutations_discard_inapropriate_pipelines,
              keep_percentage=params.mutations_keep_percentage,
              logger=self.logger,
          )
  
      elif self.method == "best_pipelines_quantiles":
          self.solver = partial(
              solver_best_pipelines_quantiles,
              generation=self.generation,
              horizon=self.horizon,
              number_models=params.bpq_number_models,
              show_progress=params.show_progress,
              logger=self.logger,
          )
  
      elif self.method == "last_generation_ql":
          self.solver = partial(
              solver_last_generation_ql,
              generation=self.generation,
              horizon=self.horizon,
              nominal_error=self.nominal_error,
              number_models=params.ql_number_models,
              iterations=params.ql_tuner_iterations,
              minutes=params.ql_tuner_minutes,
              n_jobs=params.n_jobs,
              show_progress=params.show_progress,
              up_tuner=params.ql_up_tuner,
              low_tuner=params.ql_low_tuner,
              logger=self.logger,
          )
  
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 1 to create a new PredictionIntervals object  with example: obj = PredictionIntervals(model, horizon, nominal_error, method, params)