RecursiveReductionForecaster#

class RecursiveReductionForecaster(estimator, window_length=10, impute_method='bfill', pooling='local')[source]#

递归降维预测器,包括外生变量递归。

实现递归降维,将预测问题转化为表格回归问题。

算法详情

fit 方法中,给定内生时间序列 y 和可能的外生变量 X

estimator 拟合到按如下方式定义的特征-标签对:

特征 = y(t), y(t-1), …, y(t-window_size),如果提供外生变量,还包括:X(t+1);标签 = y(t+1),涵盖所有已观测到上述值的时间点 t(即索引中存在这些时间点)。

predict 方法中,给定可能的外生变量 X,在截断时间点 c

将拟合好的估计器的 predict 方法应用于特征 = y(c), y(c-1), …, y(c-window_size),如果提供外生变量,还包括:X(c+1),以获得对 y(c+1) 的预测。如果某个 y(t) 未被观测到,则用通过同样方法获得的预测值代替 - 重复此过程直到获得所有预测值。样本外预测时,这会产生“递归”行为,即在时间点 c+1、c+2 等处的预测值是迭代获得的。样本内预测时,预测值是在一步中获得的,潜在的缺失值通过所选的 impute 策略填充。

参数
estimatorsklearn 回归器,必须兼容 sklearn 接口

降维算法中使用的表格回归算法

window_length整数,可选,默认值为 10

降维算法中使用的窗口长度

impute_method字符串,None,或 sktime 变换器,可选

用于填充滞后数据中缺失值的插补方法

  • 默认值 = "bfill"

  • 如果是字符串,允许的字符串是 Imputer.method 参数的值,详见文档。要传递更多参数,请直接传递 Imputer 变换器,如下所述。

  • 如果是 sktime 变换器,则此变换器将应用于滞后数据。这需要是一个能移除缺失数据的变换器,并且可以是 Imputer

  • 如果是 None,则应用 Lag 变换器时不进行插补

pooling字符串,可选值包括 [“local”, “global”, “panel”] 之一,默认值为 "local"

数据聚合用于拟合有监督回归模型的级别。“local” = 单元/实例级别,每个最低层级一个降维模型。“global” = 顶层级别,一个整体降维模型,忽略层级在聚合数据上拟合。“panel” = 倒数第二层级,每个面板级别一个降维模型 (-2)。如果层级数小于或等于 2,则“global”和“panel”结果相同;如果只有 1 个层级(单个时间序列),则这三个设置结果一致。

属性
cutoff

截断点 = 预测器的“当前时间”状态。

fh

传递的预测范围。

is_fitted

是否已调用 fit 方法。

方法

check_is_fitted([method_name])

检查估计器是否已拟合。

clone()

获取具有相同超参数和配置的对象的克隆。

clone_tags(estimator[, tag_names])

从另一个对象克隆标签作为动态覆盖。

create_test_instance([parameter_set])

使用第一个测试参数集构造类的实例。

create_test_instances_and_names([parameter_set])

创建所有测试实例列表及其名称列表。

fit(y[, X, fh])

将预测器拟合到训练数据。

fit_predict(y[, X, fh, X_pred])

拟合时间序列并在未来预测范围内进行预测。

get_class_tag(tag_name[, tag_value_default])

从类获取类标签值,包括父类的标签继承。

get_class_tags()

从类获取类标签,包括父类的标签继承。

get_config()

获取对象的配置标志。

get_fitted_params([deep])

获取拟合参数。

get_param_defaults()

获取对象的默认参数。

get_param_names([sort])

获取对象的参数名称。

get_params([deep])

获取此对象的参数值字典。

get_tag(tag_name[, tag_value_default, ...])

从实例获取标签值,包括标签继承和覆盖。

get_tags()

从实例获取标签,包括标签继承和覆盖。

get_test_params([parameter_set])

返回估计器的测试参数设置。

is_composite()

检查对象是否由其他 BaseObjects 组成。

load_from_path(serial)

从文件位置加载对象。

load_from_serial(serial)

从序列化内存容器加载对象。

predict([fh, X])

在未来预测范围内预测时间序列。

predict_interval([fh, X, coverage])

计算/返回预测区间预测值。

predict_proba([fh, X, marginal])

计算/返回完全概率预测值。

predict_quantiles([fh, X, alpha])

计算/返回分位数预测值。

predict_residuals([y, X])

返回时间序列预测的残差。

predict_var([fh, X, cov])

计算/返回方差预测值。

reset()

将对象重置到干净的初始化后状态。

save([path, serialization_format])

将序列化的对象保存到字节类对象或 (.zip) 文件。

score(y[, X, fh])

使用 MAPE(非对称)评估预测值与真实值。

set_config(**config_dict)

将配置标志设置为给定值。

set_params(**params)

设置此对象的参数。

set_random_state([random_state, deep, ...])

为此对象设置 random_state 伪随机种子参数。

set_tags(**tag_dict)

将实例级标签覆盖设置为给定值。

update(y[, X, update_params])

更新截断值,并可选地更新拟合参数。

update_predict(y[, cv, X, update_params, ...])

在测试集上迭代进行预测和模型更新。

update_predict_single([y, fh, X, update_params])

用新数据更新模型并进行预测。

classmethod get_test_params(parameter_set='default')[source]#

返回估计器的测试参数设置。

参数
parameter_set字符串,默认值="default"

要返回的测试参数集的名称,用于测试。如果未为此值定义特殊参数,则返回 "default" 参数集。

返回值
params字典或字典列表,默认值 = {}

创建类的测试实例的参数。每个字典都是构建一个“有趣的”测试实例的参数,即 MyClass(**params)MyClass(**params[i]) 会创建一个有效的测试实例。create_test_instance 使用 params 中的第一个(或唯一一个)字典。

check_is_fitted(method_name=None)[source]#

检查估计器是否已拟合。

检查估计器是否已拟合。is_fitted 属性应在调用对象的 fit 方法时设置为 True

如果未拟合,则引发 NotFittedError

参数
method_name字符串,可选

调用此方法的函数名称。如果提供,错误消息将包含此信息。

抛出
NotFittedError

如果估计器尚未拟合。

clone()[source]#

获取具有相同超参数和配置的对象的克隆。

克隆是另一个没有共享引用的对象,处于初始化后状态。此函数等效于返回 sklearn.cloneself

等效于使用 self 的参数构造 type(self) 的新实例,即 type(self)(**self.get_params(deep=False))

如果在 self 上设置了配置,克隆也将具有与原始对象相同的配置,等效于调用 cloned_self.set_config(**self.get_config())

在值上也等效于调用 self.reset,不同之处在于 clone 返回新对象,而不是像 reset 那样修改 self`。

抛出
如果由于 __init__ 错误导致克隆不符合要求,则引发 RuntimeError。
clone_tags(estimator, tag_names=None)[source]#

从另一个对象克隆标签作为动态覆盖。

每个兼容 scikit-base 的对象都有一个标签字典。标签可用于存储对象的元数据或控制对象的行为。

clone_tags 从另一个对象 estimator 设置动态标签覆盖。

The clone_tags method should be called only in the __init__ method of an object, during construction, or directly after construction via __init__`.` -> `clone_tags` 方法只能在对象的 `__init__` 方法中调用,即在构造过程中或通过 `__init__` 直接构造后调用。

The dynamic tags are set to the values of the tags in estimator`, with the names specified in `tag_names`.` -> 动态标签设置为 `estimator` 中标签的值,名称在 `tag_names` 中指定。

The default of tag_names` writes all tags from `estimator` to `self`.` -> `tag_names` 的默认设置会将 `estimator` 中的所有标签写入 `self`。

Current tag values can be inspected by get_tags` or `get_tag`.` -> 当前标签值可以通过 `get_tags` 或 `get_tag` 进行检查。

estimatorAn instance of :class:BaseObject or derived class

参数
estimator:class:BaseObject 或派生类的实例
tag_namesstr or list of str, default = None

tag_names字符串或字符串列表,默认值 = None

返回值
Names of tags to clone. The default (None`) clones all tags from `estimator`.` -> 要克隆的标签名称。默认值 (`None`) 会克隆 `estimator` 中的所有标签。

self

Reference to self`.` -> 对 `self` 的引用。

使用第一个测试参数集构造类的实例。

参数
parameter_set字符串,默认值="default"

classmethod create_test_instance(parameter_set='default')[source]#

返回值
Name of the set of test parameters to return, for use in tests. If no special parameters are defined for a value, will return “default” set.
要返回的测试参数集的名称,用于测试。如果未为此值定义特殊参数,则返回 “default” 参数集。

创建所有测试实例列表及其名称列表。

参数
parameter_set字符串,默认值="default"

classmethod create_test_instance(parameter_set='default')[source]#

返回值
instanceinstance of the class with default parameters

instance使用默认参数的类的实例

classmethod create_test_instances_and_names(parameter_set='default')[source]#

objslist of instances of cls

objscls 实例列表

截断点 = 预测器的“当前时间”状态。

返回值
i-th instance is cls(**cls.get_test_params()[i])`

第 i 个实例是 cls(**cls.get_test_params()[i])`

nameslist of str, same length as objs

传递的预测范围。

names字符串列表,与 objs 长度相同

将预测器拟合到训练数据。

i-th element is name of i-th instance of obj in tests. The naming convention is {cls.__name__}-{i}` if more than one instance, otherwise `{cls.__name__}`

第 i 个元素是测试中第 i 个 obj 实例的名称。如果实例多于一个,命名约定为 {cls.__name__}-{i},否则为 {cls.__name__}

property cutoff[source]#

  • cutoffpandas compatible index element, or None

  • cutoffpandas 兼容的索引元素,或 None

  • pandas compatible index element, if cutoff has been set; None otherwise

  • pandas 兼容的索引元素,如果已设置截断点;否则为 None

参数
property fh[source]#

fit(y, X=None, fh=None)[source]#

状态变化

  • 状态变为“已拟合”。

  • 写入对象本身

  • 设置以“_”结尾的拟合模型属性,拟合属性可通过 get_fitted_params 检查。

self.is_fitted 标志设置为 True

self.cutoff 设置为在 y 中看到的最后一个索引。

如果传递了 fh,则将 fh 存储到 self.fh

y采用 sktime 兼容数据容器格式的时间序列。

用于拟合预测器的时间序列。

返回值
Individual data formats in sktime are so-called mtype specifications, each mtype implements an abstract scitype.
`sktime` 中的个体数据格式是所谓的 mtype 规范,每个 mtype 实现一个抽象的 scitype

拟合时间序列并在未来预测范围内进行预测。

Series scitype = individual time series, vanilla forecasting. pd.DataFrame`, `pd.Series`, or `np.ndarray` (1D or 2D)

i-th element is name of i-th instance of obj in tests. The naming convention is {cls.__name__}-{i}` if more than one instance, otherwise `{cls.__name__}`

第 i 个元素是测试中第 i 个 obj 实例的名称。如果实例多于一个,命名约定为 {cls.__name__}-{i},否则为 {cls.__name__}

property cutoff[source]#

  • cutoffpandas compatible index element, or None

  • cutoffpandas 兼容的索引元素,或 None

  • pandas compatible index element, if cutoff has been set; None otherwise

  • Series scitype = 个体时间序列,标准预测。pd.DataFrame`,`pd.Series`,或 `np.ndarray` (1D 或 2D)。

参数
Panel scitype = collection of time series, global/panel forecasting. pd.DataFrame with 2-level row MultiIndex (instance, time)`, `3D np.ndarray` `(instance, variable, time)`, `list` of `Series` typed `pd.DataFrame`

fit(y, X=None, fh=None)[source]#

状态变化

  • 状态变为“已拟合”。

  • 写入对象本身

  • 设置以“_”结尾的拟合模型属性,拟合属性可通过 get_fitted_params 检查。

self.is_fitted 标志设置为 True

Panel scitype = 时间序列集合,全局/面板预测。具有 2 级行 MultiIndex (instance, time)` 的 pd.DataFrame`,3D np.ndarray` (instance, variable, time)`,list` 类型的 Series` 的 pd.DataFrame`。

Hierarchical scitype = hierarchical collection, for hierarchical forecasting. pd.DataFrame with 3 or more level row MultiIndex (hierarchy_1, ..., hierarchy_n, time)`

Hierarchical scitype = 分层集合,用于分层预测。具有 3 个或更多级别行 MultiIndex (hierarchy_1, ..., hierarchy_n, time)` 的 pd.DataFrame`。

y采用 sktime 兼容数据容器格式的时间序列。

用于拟合预测器的时间序列。

For further details on data format, see glossary on mtype. For usage, see forecasting tutorial examples/01_forecasting.ipynb`

有关数据格式的更多详情,请参阅 mtype 词汇表。有关使用方法,请参阅预测教程 examples/01_forecasting.ipynb`。

返回值
fhint, list, pd.Index coercible, or ForecastingHorizon`, default=None

fh整数,列表,可强制转换为 pd.Index 的对象,或 ForecastingHorizon`,默认值=None

The forecasting horizon encoding the time stamps to forecast at. If self.get_tag("requires-fh-in-fit")` is `True`, must be passed in `fit`, not optional

从类获取类标签值,包括父类的标签继承。

编码预测时间点的时间戳的预测范围。如果 self.get_tag("requires-fh-in-fit")` 为 `True`,则必须在 `fit` 中传递,不可选。

Xtime series in sktime` compatible format, optional (default=None).

X采用 sktime 兼容格式的时间序列,可选(默认值=None)。

  1. Exogeneous time series to fit the model to. Should be of same scitype (Series`, `Panel`, or `Hierarchical`) as `y`. If `self.get_tag("X-y-must-have-same-index")`, `X.index` must contain `y.index`.`

  2. 用于拟合模型的外生时间序列。应与 y` 具有相同的 scitype (Series`, `Panel`, 或 `Hierarchical`)。如果 self.get_tag("X-y-must-have-same-index")` 为 `True`,则 X.index` 必须包含 y.index`。

selfReference to self.

self对对象的引用。

fit_predict(y, X=None, fh=None, X_pred=None)[source]#

参数
Same as fit(y, X, fh).predict(X_pred)`. If `X_pred` is not passed, same as `fit(y, fh, X).predict(X)`.`

等同于 fit(y, X, fh).predict(X_pred)`。如果未传递 X_pred`,则等同于 fit(y, fh, X).predict(X)`。

Stores fh` to `self.fh`.`

fh` 存储到 self.fh`。

返回值
ytime series in sktime compatible data container format

y采用 sktime 兼容数据容器格式的时间序列

fhint, list, pd.Index coercible, or ForecastingHorizon` (not optional)

从类获取类标签,包括父类的标签继承。

每个兼容 scikit-base 的对象都有一个标签字典。标签可用于存储对象的元数据或控制对象的行为。

clone_tags 从另一个对象 estimator 设置动态标签覆盖。

fh整数,列表,可强制转换为 pd.Index 的对象,或 ForecastingHorizon`(非可选)

The forecasting horizon encoding the time stamps to forecast at.

编码预测时间点的时间戳的预测范围。

  1. Exogeneous time series to fit the model to. Should be of same scitype (Series`, `Panel`, or `Hierarchical`) as `y`. If `self.get_tag("X-y-must-have-same-index")`, `X.index` must contain `y.index`.`

  2. 用于拟合模型的外生时间序列。应与 y` 具有相同的 scitype (Series`, `Panel`, 或 `Hierarchical`)。如果 self.get_tag("X-y-must-have-same-index")` 为 `True`,则 X.index` 必须包含 y.index`。

selfReference to self.

If fh is not None and not of type ForecastingHorizon it is coerced to ForecastingHorizon via a call to _check_fh. In particular, if fh is of type pd.Index it is coerced via ForecastingHorizon(fh, is_relative=False)

如果 fh 不为 None 且不是 ForecastingHorizon 类型,则通过调用 _check_fh 将其强制转换为 ForecastingHorizon。特别是,如果 fh 是 pd.Index 类型,则通过 ForecastingHorizon(fh, is_relative=False) 进行强制转换。

self对对象的引用。

X_predtime series in sktime compatible format, optional (default=None)

X_pred采用 sktime 兼容格式的时间序列,可选(默认值=None)

Exogeneous time series to use in prediction. If passed, will be used in predict instead of X. Should be of same scitype (Series`, `Panel`, or `Hierarchical`) as `y` in `fit`. If `self.get_tag("X-y-must-have-same-index")`, `X.index` must contain `fh` index reference.`

用于预测的外生时间序列。如果传递,则将在预测中代替 X 使用。应与 fit` 中 y` 具有相同的 scitype (Series`, `Panel`, 或 `Hierarchical`)。如果 self.get_tag("X-y-must-have-same-index")` 为 `True`,则 X.index` 必须包含 fh` 索引引用。

获取对象的配置标志。

y_predtime series in sktime compatible data container format

y_pred采用 sktime 兼容数据容器格式的时间序列

Point forecasts at fh`, with same index as `fh`. `y_pred` has same type as the `y` that has been passed most recently: `Series`, `Panel`, `Hierarchical` scitype, same format (see above)`

fh` 处的点预测,与 fh` 具有相同的索引。y_pred` 的类型与最近传递的 y` 相同:Series`, `Panel`, `Hierarchical` scitype,格式相同(见上文)。

返回值
classmethod get_class_tag(tag_name, tag_value_default=None)[source]#

Every scikit-base compatible object has a dictionary of tags, which are used to store metadata about the object.

每个兼容 scikit-base` 的对象都有一个标签字典,用于存储对象的元数据。

获取拟合参数。

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

get_class_tag` 方法是一个类方法,仅考虑类级别的标签值和覆盖来检索标签的值。

参数
It returns the value of the tag with name tag_name` from the object, taking into account tag overrides, in the following order of descending priority

它返回对象中名称为 tag_name` 的标签值,按以下降序优先级考虑标签覆盖:

  • Tags set in the _tags` attribute of the class.

  • _tags` 属性中设置的标签。

返回值
Tags set in the _tags` attribute of parent classes,

父类 _tags` 属性中设置的标签,

  • in order of inheritance.

  • 按继承顺序。

  • Does not take into account dynamic tag overrides on instances, set via set_tags` or `clone_tags`, that are defined on instances.

不考虑通过 set_tags` 或 `clone_tags` 在实例上设置的动态标签覆盖。

To retrieve tag values with potential instance overrides, use the get_tag` method instead.

返回值
要检索可能包含实例覆盖的标签值,请改用 get_tag` 方法。

tag_namestr

tag_name字符串

Name of tag value.

参数
标签值的名称。

tag_value_defaultany type

返回值
tag_value_default任何类型

Default/fallback value if tag is not found.

未找到标签时的默认/回退值。

获取此对象的参数值字典。

参数
It returns the value of the tag with name tag_name` from the object, taking into account tag overrides, in the following order of descending priority

tag_value

  • tag_value

  • Value of the tag_name` tag in `self`. If not found, returns `tag_value_default`.`

返回值
self` 中 tag_name` 标签的值。如果未找到,则返回 tag_value_default`。

classmethod get_class_tags()[source]#

  • The get_class_tags` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

  • 按继承顺序。

  • Does not take into account dynamic tag overrides on instances, set via set_tags` or `clone_tags`, that are defined on instances.

get_class_tags` 方法是一个类方法,仅考虑类级别的标签值和覆盖来检索标签的值。

从实例获取标签值,包括标签继承和覆盖。

每个兼容 scikit-base 的对象都有一个标签字典。标签可用于存储对象的元数据或控制对象的行为。

clone_tags 从另一个对象 estimator 设置动态标签覆盖。

It returns a dictionary with keys being keys of any attribute of _tags` set in the class or any of its parent classes.

  1. 它返回一个字典,其键是类或其任何父类中设置的 _tags` 属性的任何键。

Values are the corresponding tag values, with overrides in the following order of descending priority

  1. Exogeneous time series to fit the model to. Should be of same scitype (Series`, `Panel`, or `Hierarchical`) as `y`. If `self.get_tag("X-y-must-have-same-index")`, `X.index` must contain `y.index`.`

  2. 用于拟合模型的外生时间序列。应与 y` 具有相同的 scitype (Series`, `Panel`, 或 `Hierarchical`)。如果 self.get_tag("X-y-must-have-same-index")` 为 `True`,则 X.index` 必须包含 y.index`。

selfReference to self.

参数
Same as fit(y, X, fh).predict(X_pred)`. If `X_pred` is not passed, same as `fit(y, fh, X).predict(X)`.`

值是相应的标签值,按以下降序优先级进行覆盖:

Instances can override these tags depending on hyper-parameters.

实例可以根据超参数覆盖这些标签。

To retrieve tags with potential instance overrides, use the get_tags` method instead.

要检索可能包含实例覆盖的标签,请改用 get_tags` 方法。

返回值
For including overrides from dynamic tags, use get_tags`.`

要包含来自动态标签的覆盖,请使用 get_tags`。

抛出
collected_tags

collected_tags

Dictionary of tag name : tag value pairs. Collected from _tags` class attribute via nested inheritance. NOT overridden by dynamic tags set by set_tags` or `clone_tags`.`

从实例获取标签,包括标签继承和覆盖。

每个兼容 scikit-base 的对象都有一个标签字典。标签可用于存储对象的元数据或控制对象的行为。

clone_tags 从另一个对象 estimator 设置动态标签覆盖。

标签名称 : 标签值 对的字典。通过嵌套继承从 _tags` 类属性收集。不被通过 set_tags` 或 `clone_tags` 设置的动态标签覆盖。

编码预测时间点的时间戳的预测范围。

  1. 它返回一个字典,其键是类或其任何父类中设置的 _tags` 属性的任何键。

Values are the corresponding tag values, with overrides in the following order of descending priority

  1. Exogeneous time series to fit the model to. Should be of same scitype (Series`, `Panel`, or `Hierarchical`) as `y`. If `self.get_tag("X-y-must-have-same-index")`, `X.index` must contain `y.index`.`

  2. 用于拟合模型的外生时间序列。应与 y` 具有相同的 scitype (Series`, `Panel`, 或 `Hierarchical`)。如果 self.get_tag("X-y-must-have-same-index")` 为 `True`,则 X.index` 必须包含 y.index`。

selfReference to self.

返回值
get_config()[source]#

标签名称: 标签值对的字典。通过嵌套继承从 _tags 类属性收集,然后从 _tags_dynamic 对象属性收集任何覆盖和新标签。

is_composite()[source]#

检查对象是否由其他 BaseObjects 组成。

复合对象是包含其他对象作为参数的对象。在实例上调用,因为这可能因实例而异。

返回值
composite: bool

对象是否具有任何参数,其值为 BaseObject 的后代实例。

property is_fitted[source]#

是否已调用 fit 方法。

检查对象的 _is_fitted` attribute that should initialize to ``False 属性,该属性应在对象构建期间初始化为 ``False``,并在调用对象的 fit 方法时设置为 True。

返回值
bool

估计器是否已进行 fit

classmethod load_from_path(serial)[source]#

从文件位置加载对象。

参数
serialZipFile(path).open(“object) 的结果
返回值
反序列化后的 self,结果输出到 path,由 cls.save(path) 生成。
classmethod load_from_serial(serial)[source]#

从序列化内存容器加载对象。

参数
serialcls.save(None) 输出的第一个元素
返回值
反序列化后的 self,结果为输出 serial,由 cls.save(None) 生成。
predict(fh=None, X=None)[source]#

在未来预测范围内预测时间序列。

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”,即 self.is_fitted=True

访问 self 中的内容

  • 以“_”结尾的已拟合模型属性。

  • self.cutoff, self.is_fitted

property cutoff[source]#

如果 fh 被传递且之前未传递过,则将 fh 存储到 self.fh

参数
self.cutoff 设置为在 y 中看到的最后一个索引。

预测范围,编码要预测的时间戳。如果已在 fit 中传递,则不应再次传递。如果未在 fit 中传递,则必须传递,不是可选的

Hierarchical scitype = 分层集合,用于分层预测。具有 3 个或更多级别行 MultiIndex (hierarchy_1, ..., hierarchy_n, time)` 的 pd.DataFrame`。

X符合 sktime 格式的时间序列,可选(默认为 None)

用于预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 fh 的索引引用。

返回值
fhint, list, pd.Index coercible, or ForecastingHorizon`, default=None

fh整数,列表,可强制转换为 pd.Index 的对象,或 ForecastingHorizon`,默认值=None

predict_interval(fh=None, X=None, coverage=0.9)[source]#

计算/返回预测区间预测值。

如果 coverage 是可迭代的,将计算多个区间。

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”,即 self.is_fitted=True

访问 self 中的内容

  • 以“_”结尾的已拟合模型属性。

  • self.cutoff, self.is_fitted

property cutoff[source]#

如果 fh 被传递且之前未传递过,则将 fh 存储到 self.fh

参数
self.cutoff 设置为在 y 中看到的最后一个索引。

预测范围,编码要预测的时间戳。如果已在 fit 中传递,则不应再次传递。如果未在 fit 中传递,则必须传递,不是可选的

如果 fh 不是 None 且不是 ForecastingHorizon 类型,它将在内部被强制转换为 ForecastingHorizon(通过 _check_fh)。

  • 如果 fhint 或类数组的 int,则将其解释为相对预测范围,并强制转换为相对的 ForecastingHorizon(fh, is_relative=True)

  • 如果 fhpd.Index 类型,则将其解释为绝对预测范围,并强制转换为绝对的 ForecastingHorizon(fh, is_relative=False)

X符合 sktime 格式的时间序列,可选(默认为 None)

用于预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 fh 的索引引用。

coverage浮点数或包含唯一浮点数值的列表,可选(默认为 0.90)

预测区间(s)的名义覆盖度(s)

返回值
pred_intpd.DataFrame
列具有多级索引:第一级是 fit 中 y 的变量名,
第二级是计算区间的覆盖度比例。

顺序与输入 coverage 中的顺序相同。

第三级是字符串“lower”或“upper”,表示区间的下限/上限。

行索引是 fh,附加(上层)级别等于实例级别,

来自 fit 中看到的 y,如果 fit 中看到的 y 是 Panel 或 Hierarchical 类型。

条目是区间下限/上限的预测值,

对应于列索引中的变量,在第二级列索引指定的名义覆盖度下,取决于第三级列索引是 lower/upper,对应于行索引的时间点。区间上限/下限预测值等同于在 alpha = 0.5 - c/2, 0.5 + c/2 (c 是 coverage 中的值) 处的分位数预测值。

predict_proba(fh=None, X=None, marginal=True)[source]#

计算/返回完全概率预测值。

Note

  • 当前仅对 Series(非面板、非层级)类型的 y 实现了此功能。

  • 返回的分布对象需要安装 skpro

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”,即 self.is_fitted=True

访问 self 中的内容

  • 以“_”结尾的已拟合模型属性。

  • self.cutoff, self.is_fitted

property cutoff[source]#

如果 fh 被传递且之前未传递过,则将 fh 存储到 self.fh

参数
self.cutoff 设置为在 y 中看到的最后一个索引。

预测范围,编码要预测的时间戳。如果已在 fit 中传递,则不应再次传递。如果未在 fit 中传递,则必须传递,不是可选的

如果 fh 不是 None 且不是 ForecastingHorizon 类型,它将在内部被强制转换为 ForecastingHorizon(通过 _check_fh)。

  • 如果 fhint 或类数组的 int,则将其解释为相对预测范围,并强制转换为相对的 ForecastingHorizon(fh, is_relative=True)

  • 如果 fhpd.Index 类型,则将其解释为绝对预测范围,并强制转换为绝对的 ForecastingHorizon(fh, is_relative=False)

X符合 sktime 格式的时间序列,可选(默认为 None)

用于预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 fh 的索引引用。

marginal布尔值,可选(默认为 True)

返回的分布是否是按时间索引的边际分布

返回值
pred_distskpro BaseDistribution

如果 marginal=True,则为预测分布;如果 marginal=False 且由方法实现,则为按时间点的边际分布,否则为联合分布。

predict_quantiles(fh=None, X=None, alpha=None)[source]#

计算/返回分位数预测值。

如果 alpha 是可迭代的,将计算多个分位数。

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”,即 self.is_fitted=True

访问 self 中的内容

  • 以“_”结尾的已拟合模型属性。

  • self.cutoff, self.is_fitted

property cutoff[source]#

如果 fh 被传递且之前未传递过,则将 fh 存储到 self.fh

参数
self.cutoff 设置为在 y 中看到的最后一个索引。

预测范围,编码要预测的时间戳。如果已在 fit 中传递,则不应再次传递。如果未在 fit 中传递,则必须传递,不是可选的

如果 fh 不是 None 且不是 ForecastingHorizon 类型,它将在内部被强制转换为 ForecastingHorizon(通过 _check_fh)。

  • 如果 fhint 或类数组的 int,则将其解释为相对预测范围,并强制转换为相对的 ForecastingHorizon(fh, is_relative=True)

  • 如果 fhpd.Index 类型,则将其解释为绝对预测范围,并强制转换为绝对的 ForecastingHorizon(fh, is_relative=False)

X符合 sktime 格式的时间序列,可选(默认为 None)

用于预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 fh 的索引引用。

alpha浮点数或包含唯一浮点数值的列表,可选(默认为 [0.05, 0.95])

计算分位数预测值时的概率或概率列表。

返回值
quantilespd.DataFrame
列具有多级索引:第一级是 fit 中 y 的变量名,

第二级是传递给函数的 alpha 值。

行索引是 fh,附加(上层)级别等于实例级别,

来自 fit 中看到的 y,如果 fit 中看到的 y 是 Panel 或 Hierarchical 类型。

条目是分位数预测值,对应于列索引中的变量,

在第二级列索引指定的分位数概率下,对应于行索引的时间点。

predict_residuals(y=None, X=None)[source]#

返回时间序列预测的残差。

将根据 y.index 的预测值计算残差。

如果 fit 中必须传递 fh,则必须与 y.index 一致。如果 y 是一个 np.ndarray,并且在 fit 中没有传递 fh,则残差将在 range(len(y.shape[0])) 的 fh 处计算。

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”。如果已设置 fh,则必须与 y 的索引(pandas 或整数)对应。

访问 self 中的内容

以“_”结尾的已拟合模型属性。 self.cutoff, self._is_fitted

property cutoff[source]#

无。

参数
Panel scitype = collection of time series, global/panel forecasting. pd.DataFrame with 2-level row MultiIndex (instance, time)`, `3D np.ndarray` `(instance, variable, time)`, `list` of `Series` typed `pd.DataFrame`

具有真实观测值的时间序列,用于计算残差。必须与 predict 的预期返回类型、维度和索引相同。

如果为 None,则使用目前为止看到的 y (self._y),特别是

  • 如果之前只调用了一次 fit,则生成样本内残差

  • 如果 fit 需要 fh,则它必须指向 fit 中 y 的索引

X符合 sktime 格式的时间序列,可选(默认为 None)

用于更新和预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须同时包含 fh 的索引引用和 y.index

返回值
y_res符合 sktime 格式的数据容器中的时间序列

fh 处的预测残差,与 fh 具有相同的索引。 y_res 与最近传递的 y 类型相同:Series, Panel, Hierarchical 科学类型,格式相同(见上文)

predict_var(fh=None, X=None, cov=False)[source]#

计算/返回方差预测值。

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”,即 self.is_fitted=True

访问 self 中的内容

  • 以“_”结尾的已拟合模型属性。

  • self.cutoff, self.is_fitted

property cutoff[source]#

如果 fh 被传递且之前未传递过,则将 fh 存储到 self.fh

参数
self.cutoff 设置为在 y 中看到的最后一个索引。

预测范围,编码要预测的时间戳。如果已在 fit 中传递,则不应再次传递。如果未在 fit 中传递,则必须传递,不是可选的

如果 fh 不是 None 且不是 ForecastingHorizon 类型,它将在内部被强制转换为 ForecastingHorizon(通过 _check_fh)。

  • 如果 fhint 或类数组的 int,则将其解释为相对预测范围,并强制转换为相对的 ForecastingHorizon(fh, is_relative=True)

  • 如果 fhpd.Index 类型,则将其解释为绝对预测范围,并强制转换为绝对的 ForecastingHorizon(fh, is_relative=False)

X符合 sktime 格式的时间序列,可选(默认为 None)

用于预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 fh 的索引引用。

cov布尔值,可选(默认为 False)

如果为 True,计算协方差矩阵预测。如果为 False,计算边际方差预测。

返回值
pred_varpd.DataFrame,格式取决于 cov 变量
如果 cov=False
列名与 fit/update 中传递的 y 的列名完全相同。

对于无名格式,列索引将是 RangeIndex。

行索引是 fh,附加级别等于实例级别,

来自 fit 中看到的 y,如果 fit 中看到的 y 是 Panel 或 Hierarchical 类型。

条目是方差预测值,对应于列索引中的变量。给定变量和 fh 索引的方差预测值是一个预测的

该变量和索引的方差,基于观测到的数据。

如果 cov=True
列索引是多级索引:第一级是变量名(如上所述)

第二级是 fh。

行索引是 fh,附加级别等于实例级别,

来自 fit 中看到的 y,如果 fit 中看到的 y 是 Panel 或 Hierarchical 类型。

条目是(协)方差预测值,对应于列索引中的变量,以及

行索引和列索引中时间点之间的协方差。

注意:不同变量之间不返回协方差预测值。

reset()[source]#

将对象重置到干净的初始化后状态。

结果是将 self 设置为其在构造函数调用后的状态,具有相同的超参数。通过 set_config 设置的配置值也会被保留。

调用 reset 会删除所有对象属性,除了

  • 超参数 = 写入到 self__init__ 的参数,例如 self.paramname,其中 paramname__init__ 的一个参数。

  • 包含双下划线的对象属性,即字符串“__”。例如,名为“__myattr”的属性会被保留。

  • 配置属性,配置会被保留且不变。也就是说,调用 reset 前后 get_config 的结果是相同的。

类方法、对象方法以及类属性也不受影响。

等同于 clone,但 reset 是改变 self 自身而不是返回一个新对象。

调用 self.reset() 后,self 在值和状态上等于通过构造函数调用``type(self)(**self.get_params(deep=False))``获得的对象。

返回值
Names of tags to clone. The default (None`) clones all tags from `estimator`.` -> 要克隆的标签名称。默认值 (`None`) 会克隆 `estimator` 中的所有标签。

类实例被重置到干净的初始化后状态,但保留当前的超参数值。

save(path=None, serialization_format='pickle')[source]#

将序列化的对象保存到字节类对象或 (.zip) 文件。

行为:如果 path 为 None,则返回一个内存中的序列化 self;如果 path 是文件位置,则将 self 存储在该位置作为 zip 文件

保存的文件是 zip 文件,包含以下内容:_metadata - 包含 self 的类,即 type(self);_obj - 序列化后的 self。此类别使用默认序列化方式 (pickle)。

参数
pathNone 或文件位置(字符串或 Path 对象)

如果为 None,则将 self 保存到内存对象;如果是文件位置,则将 self 保存到该文件位置。例如,如果

  • path=”estimator”,则将在当前工作目录生成一个 zip 文件 estimator.zip

  • path=”/home/stored/estimator”,则将生成一个 zip 文件 estimator.zip

存储在 /home/stored/ 中。

serialization_format: str, 默认为 “pickle”

用于序列化的模块。可用选项包括“pickle”和“cloudpickle”。注意,非默认格式可能需要安装其他软依赖项。

返回值
如果 path 为 None - 内存中的序列化 self
如果 path 是文件位置 - ZipFile 对象引用该文件
score(y, X=None, fh=None)[source]#

使用 MAPE(非对称)评估预测值与真实值。

参数
ypd.Series, pd.DataFrame, 或 np.ndarray (1D 或 2D)

要评分的时间序列

self.cutoff 设置为在 y 中看到的最后一个索引。

Hierarchical scitype = hierarchical collection, for hierarchical forecasting. pd.DataFrame with 3 or more level row MultiIndex (hierarchy_1, ..., hierarchy_n, time)`

Xpd.DataFrame, 或 2D np.array, 可选(默认为 None)

用于评分的外部时间序列。如果 self.get_tag(“X-y-must-have-same-index”) 为 True,X.index 必须包含 y.index

返回值
score浮点数

self.predict(fh, X) 相对于 y_test 的 MAPE 损失。

set_config(**config_dict)[source]#

将配置标志设置为给定值。

参数
classmethod get_class_tag(tag_name, tag_value_default=None)[source]#

配置名称: 配置值对的字典。有效的配置、值及其含义如下所列

display字符串,“diagram”(默认)或“text”

jupyter 内核如何显示 self 的实例

  • “diagram” = HTML 框图表示

  • “text” = 字符串打印输出

print_changed_only布尔值,默认为 True

打印 self 时是否仅列出与默认值不同的 self 参数(False),还是列出所有参数名称和值(False)。不进行嵌套,即仅影响 self,不影响组件估计器。

warnings字符串,“on”(默认)或“off”

是否发出警告,仅影响来自 sktime 的警告

  • “on” = 将发出来自 sktime 的警告

  • “off” = 将不发出来自 sktime 的警告

backend:parallel字符串,可选,默认为“None”

广播/向量化时用于并行的后端,可以是以下之一

  • “None”:顺序执行循环,简单的列表推导式

  • “loky”、“multiprocessing”和“threading”:使用 joblib.Parallel

  • “joblib”:自定义和第三方 joblib 后端,例如 spark

  • “dask”:使用 dask,需要环境中安装 dask

  • “ray”:使用 ray,需要环境中安装 ray

backend:parallel:params字典,可选,默认为 {}(不传递参数)

作为配置传递给并行化后端的附加参数。有效键取决于 backend:parallel 的值

  • “None”:没有附加参数,忽略 backend_params

  • “loky”、“multiprocessing”和“threading”:默认的 joblib 后端,可以在此处传递 joblib.Parallel 的任何有效键,例如 n_jobs,但 backend 除外,它直接由 backend 控制。如果未传递 n_jobs,它将默认为 -1,其他参数将默认为 joblib 默认值。

  • “joblib”:自定义和第三方 joblib 后端,例如 spark。可以在此处传递 joblib.Parallel 的任何有效键,例如 n_jobs,在这种情况下,backend 必须作为 backend_params 的一个键传递。如果未传递 n_jobs,它将默认为 -1,其他参数将默认为 joblib 默认值。

  • “dask”:可以传递 dask.compute 的任何有效键,例如 scheduler

  • “ray”:可以传递以下键

    • “ray_remote_args”:ray.init 的有效键字典

    • “shutdown_ray”:布尔值,默认为 True;False 阻止 ray

      并行化后关闭。

    • “logger_name”:字符串,默认为“ray”;要使用的日志记录器名称。

    • “mute_warnings”:布尔值,默认为 False;如果为 True,则抑制警告

remember_data布尔值,默认为 True

fit 中是否存储 self._Xself._y,并在 update 中更新。如果为 True,则存储并更新 self._Xself._y。如果为 False,则不存储和更新 self._Xself._y。这在使用 save 时减小了序列化大小,但 update 将默认为“不做任何事情”,而不是“重新拟合所有已见数据”。

返回值
self对 self 的引用。

Notes

改变对象状态,将 config_dict 中的配置复制到 self._config_dynamic

set_params(**params)[source]#

设置此对象的参数。

该方法适用于简单的 skbase 对象以及复合对象。参数键字符串 <component>__<parameter> 可用于复合对象(即包含其他对象的对象),以访问组件 <component> 中的 <parameter>。如果引用是明确的(例如,没有两个组件参数具有相同的名称 <parameter>),也可以使用不带 <component>__ 的字符串 <parameter>

参数
**params字典

BaseObject 参数,键必须是 <component>__<parameter> 字符串。如果 get_params 键中唯一,__ 后缀可以作为完整字符串的别名。

返回值
self对 self 的引用(设置参数后)
set_random_state(random_state=None, deep=True, self_policy='copy')[source]#

为此对象设置 random_state 伪随机种子参数。

通过 self.get_params 查找名为 random_state 的参数,并使用 set_params 将它们设置为从输入的 random_state 派生出的整数。这些整数通过 sample_dependent_seed 的链式哈希进行采样,保证了 seeded 随机生成器的伪随机独立性。

根据 self_policy,应用于 self 中的 random_state 参数,并且仅当 deep=True 时应用于其余组件对象。

注意:即使 self 没有 random_state 参数,或者任何组件都没有 random_state 参数,也会调用 set_params。因此,set_random_state 会重置任何 scikit-base 对象,即使那些没有 random_state 参数的对象也会被重置。

参数
random_state整数,RandomState 实例或 None,默认为 None

伪随机数生成器,用于控制随机整数的生成。传递整数可在多次函数调用中产生可复现的输出。

It returns the value of the tag with name tag_name` from the object, taking into account tag overrides, in the following order of descending priority

是否在值为 skbase 对象的参数中设置随机状态,即组件估计器中。

  • 如果为 False,则仅设置 selfrandom_state 参数(如果存在)。

  • 如果为 True,则也会设置组件对象中的 random_state 参数。

self_policy字符串,取值范围为 {“copy”, “keep”, “new”} 之一,默认为“copy”
  • “copy”:将 self.random_state 设置为输入的 random_state

  • “keep”:self.random_state 保持不变

  • “new”:将 self.random_state 设置为一个新的随机状态,

派生自输入的 random_state,并且通常与它不同

返回值
self对 self 的引用
set_tags(**tag_dict)[source]#

将实例级标签覆盖设置为给定值。

编码预测时间点的时间戳的预测范围。如果 self.get_tag("requires-fh-in-fit")` 为 `True`,则必须在 `fit` 中传递,不可选。

标签是特定于实例 self 的键值对,它们是对象构建后不会更改的静态标志。它们可用于元数据检查或控制对象的行为。

set_tags 将动态标签覆盖设置为 tag_dict 中指定的值,其中键是标签名称,字典值是要设置的标签值。

set_tags 方法只能在对象的 __init__ 方法中,在构建期间,或通过 __init__ 构建后直接调用。

estimatorAn instance of :class:BaseObject or derived class

参数
**tag_dict字典

标签名称: 标签值对的字典。

返回值
Self

对 self 的引用。

update(y, X=None, update_params=True)[source]#

更新截断值,并可选地更新拟合参数。

如果没有实现估计器特定的 update 方法,默认的回退行为如下

  • update_params=True:拟合所有目前为止观测到的数据

  • update_params=False:仅更新 cutoff 并记住数据

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”,即 self.is_fitted=True

访问 self 中的内容

  • 以“_”结尾的已拟合模型属性。

  • self.cutoff, self.is_fitted

property cutoff[source]#

  • self.cutoff 更新为 y 中看到的最新索引。

  • 如果 update_params=True,则更新以“_”结尾的已拟合模型属性。

参数
property fh[source]#

用于更新预测器的时间序列。

状态变化

  • 状态变为“已拟合”。

  • 写入对象本身

  • 设置以“_”结尾的拟合模型属性,拟合属性可通过 get_fitted_params 检查。

self.is_fitted 标志设置为 True

y采用 sktime 兼容数据容器格式的时间序列。

用于更新模型拟合的外部时间序列。应与 y科学类型Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 y.index

update_params布尔值,可选(默认为 True)

是否应该更新模型参数。如果为 False,则仅更新截止点 (cutoff),模型参数(例如系数)不更新。

返回值
self对 self 的引用
update_predict(y, cv=None, X=None, update_params=True, reset_forecaster=True)[source]#

在测试集上迭代进行预测和模型更新。

执行多个 update / predict 调用链的简写,数据回放基于时间序列分割器 cv

等同于以下操作(如果只有 ycv 不是默认值)

  1. self.update(y=cv.split_series(y)[0][0])

  2. 记住 self.predict() 的结果(稍后在单个批次中返回)

  3. self.update(y=cv.split_series(y)[1][0])

  4. 记住 self.predict() 的结果(稍后在单个批次中返回)

  5. 等等

  6. 返回所有记住的预测值

如果没有实现估计器特定的 update 方法,默认的回退行为如下

  • update_params=True:拟合所有目前为止观测到的数据

  • update_params=False:仅更新 cutoff 并记住数据

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

要求状态为“已拟合”,即 self.is_fitted=True

访问 self 中的内容

  • 以“_”结尾的已拟合模型属性。

  • self.cutoff, self.is_fitted

写入 self(除非 reset_forecaster=True
  • self.cutoff 更新为 y 中看到的最新索引。

  • 如果 update_params=True,则更新以“_”结尾的已拟合模型属性。

如果 reset_forecaster=True,则不更新状态。

参数
property fh[source]#

用于更新预测器的时间序列。

状态变化

  • 状态变为“已拟合”。

  • 写入对象本身

  • 设置以“_”结尾的拟合模型属性,拟合属性可通过 get_fitted_params 检查。

self.is_fitted 标志设置为 True

cv继承自 BaseSplitter 的时间序列交叉验证生成器,可选

例如,SlidingWindowSplitterExpandingWindowSplitter;默认 = 使用 initial_window=1 的 ExpandingWindowSplitter 和默认值 = y/X 中的单个数据点被逐个添加和预测,initial_window = 1step_length = 1fh = 1

X符合 sktime 格式的时间序列,可选(默认为 None)

用于更新和预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 fh 的索引引用。

update_params布尔值,可选(默认为 True)

是否应该更新模型参数。如果为 False,则仅更新截止点 (cutoff),模型参数(例如系数)不更新。

reset_forecaster布尔值,可选(默认为 True)
  • 如果为 True,则不会改变预测器的状态,即 update/predict 序列使用副本运行,self 的截止点 (cutoff)、模型参数、数据内存均不改变

  • 如果为 False,则在运行 update/predict 序列时会更新 self,如同直接调用 update/predict 一样

返回值
y_pred表格化多个分割批次的点预测值的对象

格式取决于预测的 (cutoff, 绝对预测范围) 对

  • 如果绝对预测范围点的集合是唯一的:类型是符合 sktime 格式的数据容器中的时间序列 输出中省略 cutoff 与最近传递的 y 类型相同:Series, Panel, Hierarchical 科学类型,格式相同(见上文)

  • 如果绝对预测范围点的集合不唯一:类型是一个 pandas DataFrame,其行索引和列索引都是时间戳 行索引对应于用于预测的 cutoff 列索引对应于预测的绝对预测范围 条目是从行索引预测列索引的点预测值 如果在该 (cutoff, horizon) 对下没有进行预测,则条目为 nan

update_predict_single(y=None, fh=None, X=None, update_params=True)[source]#

用新数据更新模型并进行预测。

此方法适用于在一个步骤中进行更新和预测。

如果没有实现估计器特定的 update 方法,默认的回退行为是先 update,然后 predict。

The get_class_tag` method is a class method, and retrieves the value of a tag taking into account only class-level tag values and overrides.

get_class_tag` 方法是一个类方法,仅考虑类级别的标签值和覆盖来检索标签的值。

访问 self 中的内容

以“_”结尾的已拟合模型属性。指向已见数据的指针,self._y 和 self.X self.cutoff, self._is_fitted 如果 update_params=True,则为以“_”结尾的模型属性。

property cutoff[source]#

通过追加行,使用 yX 更新 self._yself._X。将 self.cutoffself._cutoff 更新为 y 中看到的最后一个索引。如果 update_params=True,

更新以“_”结尾的已拟合模型属性。

参数
property fh[source]#

用于更新预测器的时间序列。

状态变化

  • 状态变为“已拟合”。

  • 写入对象本身

  • 设置以“_”结尾的拟合模型属性,拟合属性可通过 get_fitted_params 检查。

self.is_fitted 标志设置为 True

self.cutoff 设置为在 y 中看到的最后一个索引。

预测范围,编码要预测的时间戳。如果已在 fit 中传递,则不应再次传递。如果未在 fit 中传递,则必须传递,不是可选的

X符合 sktime 格式的时间序列,可选(默认为 None)

用于更新和预测的外部时间序列。应与 fity 的科学类型(Series, Panel, 或 Hierarchical)相同。如果 self.get_tag("X-y-must-have-same-index") 为 True,则 X.index 必须包含 fh 的索引引用。

update_params布尔值,可选(默认为 True)

是否应该更新模型参数。如果为 False,则仅更新截止点 (cutoff),模型参数(例如系数)不更新。

返回值
fhint, list, pd.Index coercible, or ForecastingHorizon`, default=None

fh整数,列表,可强制转换为 pd.Index 的对象,或 ForecastingHorizon`,默认值=None