gluonts.ext.rotbaum package#
- class gluonts.ext.rotbaum.TreeEstimator(**kwargs)[source]#
Bases:
gluonts.ext.rotbaum._estimator.ThirdPartyEstimator
- lead_time: int#
- prediction_length: int#
- class gluonts.ext.rotbaum.TreePredictor(freq: str, prediction_length: int, n_ignore_last: int = 0, lead_time: int = 0, max_n_datapts: int = 1000000, min_bin_size: int = 100, 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: Union[List[int], gluonts.ext.rotbaum._preprocess.CardinalityLabel] = 'auto', one_hot_encode: bool = False, model_params: Optional[dict] = None, max_workers: Optional[int] = None, method: str = 'QRX', quantiles=None, subtract_mean: bool = True, count_nans: bool = False, model=None, seed=None)[source]#
Bases:
gluonts.model.predictor.RepresentablePredictor
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.
- classmethod deserialize(path: pathlib.Path, **kwargs: Any) gluonts.ext.rotbaum._predictor.TreePredictor [source]#
This function loads and returns the serialized model.
It loads the predictor class with the serialized arguments. It then loads the trained model list by reading the pickle file.
- explain(importance_type: str = 'gain', percentage: bool = True) gluonts.ext.rotbaum._types.ExplanationResult [source]#
This function only works for
self.method == "QuantileRegression"
, and uses lightgbm’s feature importance functionality. It takes the mean feature importance across quantiles and timestamps in the forecast horizon; and then adds these mean values across all of the feature coordinates that are associated to “target”, “feat_static_real”, “feat_static_cat”, “past_feat_dynamic_real”, “feat_dynamic_real”, “feat_dynamic_cat”.- Parameters
importance_type (str) – Either “gain” or “split”. Since for the models that predict timestamps that are further along in the forecast horizon are expected to perform less well, it is desirable to give less weight to those models compared to the ones that make predictions for timestamps closer to the forecast horizon. “split” will give equal weight, and is therefore less desirable; whereas “gain” will naturally give less weight to models that perform less well.
percentage (bool) – If results should be in percentage format and sum up to 1. Default is True
- Return type
ExplanationResult
- predict(dataset: gluonts.dataset.Dataset, num_samples: Optional[int] = None) Iterator[gluonts.model.forecast.Forecast] [source]#
Returns a dictionary taking each quantile to a list of floats, which are the predictions for that quantile as you run over (time_steps, time_series) lexicographically.
So: first it would give the quantile prediction for the first time step for all time series, then the second time step for all time series ˜˜ , and so forth.