pytorch_forecasting.data.encoders.
TorchNormalizer
Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin
sklearn.base.BaseEstimator
sklearn.base.TransformerMixin
Basic target transformer that can be fit also on torch tensors.
Initialize
method (str, optional) – method to rescale series. Either “standard” (standard scaling) or “robust” (scale using quantiles 0.25-0.75). Defaults to “standard”.
center (bool, optional) – If to center the output to zero. Defaults to True.
log_scale (bool, optional) – If to take log of values. Defaults to False. Defaults to False.
log_zero_value (float, optional) – Value to map 0 to for log_scale=True or in softplus. Defaults to -inf.
log_scale=True
coerce_positive (Union[bool, float, str], optional) – If to coerce output to positive. Valid values: * None, i.e. is automatically determined and might change to True if all values are >= 0 (Default). * True, i.e. output is clamped at 0. * False, i.e. values are not coerced * float, i.e. softmax is applied with beta = coerce_positive.
eps (float, optional) – Number for numerical stability of calcualtions. Defaults to 1e-8. For count data, 1.0 is recommended.
Methods
fit(y)
fit
Fit transformer, i.e. determine center and scale of data.
fit_transform(X[, y])
fit_transform
Fit to data, then transform it.
get_parameters(*args, **kwargs)
get_parameters
Returns parameters that were used for encoding.
get_params([deep])
get_params
Get parameters for this estimator.
inverse_transform(y)
inverse_transform
Inverse scale.
set_params(**params)
set_params
Set the parameters of this estimator.
transform(y[, return_norm, target_scale])
transform
Rescale data.
Fit transformer, i.e. determine center and scale of data
y (Union[pd.Series, np.ndarray, torch.Tensor]) – input data
self
First element is center of data and second is scale
torch.Tensor
y (torch.Tensor) – scaled data
de-scaled data
return_norm (bool, optional) – [description]. Defaults to False.
target_scale (torch.Tensor) – target scale to use instead of fitted center and scale
data with type depending on input type. returns second element if return_norm=True
return_norm=True
Union[Tuple[Union[np.ndarray, torch.Tensor], np.ndarray], Union[np.ndarray, torch.Tensor]]