paddlets.models.representation.task.repr_forecasting
- class ReprForecasting(in_chunk_len: int, out_chunk_len: int, repr_model: ReprBaseModel, skip_chunk_len: int = 0, sampling_stride: int = 1, repr_model_params: Optional[dict] = None, encode_params: Optional[dict] = None, downstream_learner: Optional[Callable] = None, verbose: bool = False)[source]
Bases:
StackingEnsembleBase,BaseModelThe ReprForecasting Class.
- Parameters
in_chunk_len (int) – The size of previous time point window to use for representation results
out_chunk_len (int) – The size of the forecasting horizon, i.e., the number of time steps output by the model.
repr_model (ReprBasemodel) – Representation model to use for forcast.
skip_chunk_len (int) – Optional, the number of time steps between in_chunk and out_chunk for a single sample. The skip chunk is neither used as a feature (i.e. X) nor a label (i.e. Y) for a single sample. By default, it will NOT skip any time steps.
sampling_stride – Sampling intervals between two adjacent samples.
repr_model_params (dict) – params for reprmodel init.
encode_params (dict) – params for reprmodel encode, “slide_len” will set to in_chunk_len by force.
downstream_learner (Callable) – The downstream learner, should be a sklearn-like regressor, set to Ridge(alpha=0.5) by default.
verbose (bool) – Turn on Verbose mode,set to true by default.
- predict(tsdataset: TSDataset) TSDataset[source]
Predict
- Parameters
tsdataset (TSDataset) – Dataset to predict.
- save(path: str, repr_forecaster_file_name: str = 'repr-forecaster-partial.pkl') None[source]
Save the repr-forecaster model to a directory.
- Parameters
path (str) – Output directory path.
ensemble_file_name (str) – Name of repr-forecaster model object. This file contains meta information of repr-forecaster model.
- static load(path: str, repr_forecaster_file_name: str = 'repr-forecaster-partial.pkl') StackingEnsembleForecaster[source]
Load the repr-forecaster model from a directory.
- Parameters
path (str) – Input directory path.
ensemble_file_name (str) – Name of repr-forecaster model object. This file contains meta information of repr-forecaster model.
- Returns
The loaded ensemble model.