class_docstr: A predictor that uses a QRX model for each of the steps in the forecast
  horizon.
  
  (In other words, there's a total of prediction_length many models being
  trained. In particular, this predictor does not learn a multivariate
  distribution.) The list of these models is saved under self.model_list.
code: def __init__(
      self,
      freq: str,
      prediction_length: int,
      n_ignore_last: int = 0,
      lead_time: int = 0,
      max_n_datapts: int = 1000000,
      min_bin_size: int = 100,  # Used only for "QRX" method.
      context_length: Optional[int] = None,
      use_feat_static_real: bool = False,
      use_past_feat_dynamic_real: bool = False,
      use_feat_dynamic_real: bool = False,
      use_feat_dynamic_cat: bool = False,
      cardinality: Cardinality = "auto",  # type: ignore
      one_hot_encode: bool = False,
      model_params: Optional[dict] = None,
      max_workers: Optional[int] = None,
      method: str = "QRX",
      quantiles=None,  # Used only for "QuantileRegression" method.
      subtract_mean: bool = True,
      count_nans: bool = False,
      model=None,
      seed=None,
  ) -> None:
      assert method in [
          "QRX",
          "QuantileRegression",
          "QRF",
      ], "method has to be either 'QRX', 'QuantileRegression', or 'QRF'"
      self.method = method
      self.lead_time = lead_time
      self.context_length = (
          context_length
          if context_length is not None
          else prediction_length
      )
      self.preprocess_object = PreprocessOnlyLagFeatures(
          self.context_length,
          forecast_horizon=prediction_length,
          stratify_targets=False,
          n_ignore_last=n_ignore_last,
          max_n_datapts=max_n_datapts,
          use_feat_static_real=use_feat_static_real,
          use_past_feat_dynamic_real=use_past_feat_dynamic_real,
          use_feat_dynamic_real=use_feat_dynamic_real,
          use_feat_dynamic_cat=use_feat_dynamic_cat,
          cardinality=cardinality,
          one_hot_encode=one_hot_encode,
          subtract_mean=subtract_mean,
          count_nans=count_nans,
          seed=seed,
      )
  
      assert (
          context_length is None or context_length > 0
      ), "The value of `context_length` should be > 0"
  
      # TODO: Figure out how to include 'auto' with no feat_static_cat in
      # this check
      assert (
          prediction_length > 0
          or use_feat_dynamic_cat
          or use_past_feat_dynamic_real
          or use_feat_dynamic_real
          or use_feat_static_real
          or cardinality != "ignore"
      ), (
          "The value of `prediction_length` should be > 0 or there should be"
          " features for model training and prediction "
      )
  
      self.model_params = model_params if model_params else {}
      self.prediction_length = prediction_length
      self.freq = freq
      self.max_workers = max_workers
      self.min_bin_size = min_bin_size
      self.quantiles = quantiles
      self.model = model
      self.model_list: Optional[list] = None
  
      logger.info(
          "If using the Evaluator class with a TreePredictor, set"
          " num_workers=0."
      )
  
imports: import concurrent.futures
  import logging
  import pickle
  from itertools import chain
  from typing import Iterator, List, Optional, Any, Dict
  from toolz import first
  import numpy
  import pandas
  from pathlib import Path
  from itertools import compress
  from gluonts.core.component import validated
  from gluonts.dataset.common import Dataset
  from gluonts.dataset.util import forecast_start
  from gluonts.model.forecast import Forecast
  from gluonts.model.forecast_generator import log_once
  from gluonts.model.predictor import RepresentablePredictor
  from ._model import QRF, QRX, QuantileReg
  from ._preprocess import Cardinality, PreprocessOnlyLagFeatures
  from ._types import FeatureImportanceResult, ExplanationResult
label_desc: Use image node_id 1 to create a new TreePredictor object from inherited base classes: RepresentablePredictor with example: obj = TreePredictor(freq, prediction_length, n_ignore_last, lead_time, max_n_datapts, min_bin_size, context_length, use_feat_static_real, use_past_feat_dynamic_real, use_feat_dynamic_real, use_feat_dynamic_cat, cardinality, one_hot_encode, model_params, max_workers, method, quantiles, subtract_mean, count_nans, model, seed)