pyts.preprocessing.StandardScaler¶
-
class
pyts.preprocessing.StandardScaler(with_mean=True, with_std=True)[来源]¶ 通过去除均值并缩放至单位方差来标准化时间序列。
参数: - with_mean : bool (默认 = True)
如果为True,在缩放前对数据进行中心化处理。
- with_std : bool (默认 = True)
如果为True,将数据缩放到单位方差。
示例
>>> from pyts.preprocessing import StandardScaler >>> X = [[0, 2, 0, 4, 4, 6, 4, 4], ... [1, 0, 3, 2, 2, 2, 0, 2]] >>> scaler = StandardScaler() >>> scaler.transform(X) array([[-1.5, -0.5, -1.5, 0.5, 0.5, 1.5, 0.5, 0.5], [-0.5, -1.5, 1.5, 0.5, 0.5, 0.5, -1.5, 0.5]])
方法
__init__([with_mean, with_std])Initialize self. fit([X, y])Pass. fit_transform(X[, y])Fit to data, then transform it. get_params([deep])Get parameters for this estimator. set_params(**params)Set the parameters of this estimator. transform(X)Perform standardization by centering and scaling. -
fit_transform(X, y=None, **fit_params)¶ 拟合数据,然后进行转换。
使用可选参数fit_params将转换器适配到X和y,并返回转换后的X版本。
参数: - X : array-like, shape = (n_samples, n_timestamps)
单变量时间序列。
- y : None or array-like, shape = (n_samples,) (default = None)
目标值(无监督转换时为None)。
- **fit_params : dict
额外的拟合参数。
返回值: - X_new : array
转换后的数组。
-
get_params(deep=True)¶ 获取此估计器的参数。
参数: - deep : bool, default=True
如果为True,将返回此估计器及其包含的子估计器的参数。
返回值: - params : dict
参数名称映射到对应的值。