paddlets.ensemble.stacking_ensemble
- class StackingEnsembleBase(estimators: List[Tuple[object, dict]], final_learner: Optional[Callable] = None, verbose: bool = False)[源代码]
基类:
EnsembleBaseStacking集成模型基类
- 参数
estimators (List[Tuple[object, dict]]) – 一个由paddlets模型组成的 tuple (模型类名,模型参数) 列表
final_learner (Callable) – 第二层的集成模型元学习器,必须为sklearn类型的回归模型, 默认使用GradientBoostingRegressor(max_depth=5)
verbose (bool) – 是否开启日志,默认开启
- class StackingEnsembleForecaster(in_chunk_len: int, out_chunk_len: int, skip_chunk_len: int, estimators: List[Tuple[object, dict]], final_learner: Optional[Callable] = None, use_backtest: bool = True, resampling_strategy: str = 'cv', split_ratio: Union[str, float] = 0.1, k_fold: Union[str, int] = 3, verbose: bool = False)[源代码]
基类:
StackingEnsembleBase,BaseModelStacking集成预测
- 参数
in_chunk_len (int) – 模型输入的时间序列长度
out_chunk_len (int) – 模型输出的序列长度
skip_chunk_len (int) – 可选变量, 输入序列与输出序列之间跳过的序列长度,既不作为特征也不作为预测目标使用,默认值为0
estimators (List[Tuple[object, dict]]) – 一个由paddlets模型组成的 tuple (模型类名,模型参数) 列表
final_learner (Callable) – 第二层的集成模型元学习器,必须为sklearn类型的回归模型, 默认使用GradientBoostingRegressor(max_depth=5)
resampling_strategy (str) – 底层模型重采样策略,支持(cv,holdout)
split_ratio (Union[str, float]) – holdout重采样策略的参数,代表验证集的比例,应该在(0,1)区间
k_fold (Union[str, int]) – 底层模型时序交叉验证cv的参数,代表交叉验证的轮数,在(0,10]之间,默认为3
use_backtest (bool) – 是否开启回测在底层模型,默认为True
verbose (bool) – 是否开启日志,默认开启
- save(path: str, ensemble_file_name: str = 'paddlets-stacking-forecaster-partial.pkl') None[源代码]
保存模型
- 参数
path (str) – 保存路径
ensemble_file_name (str) – 模型文件名
- static load(path: str, ensemble_file_name: str = 'paddlets-stacking-forecaster-partial.pkl') StackingEnsembleForecaster[源代码]
加载模型
- 参数
path (str) – 加载路径
ensemble_file_name (str) – 模型文件名
- 返回
加载的模型