MultiNormalizer#
- class pytorch_forecasting.data.encoders.MultiNormalizer(normalizers: list[TorchNormalizer])[source]#
Bases:
TorchNormalizerNormalizer for multiple targets.
This normalizers wraps multiple other normalizers.
- Parameters:
normalizers (List[TorchNormalizer]) – list of normalizers to apply to targets
- Inherited-members:
Methods
extra_repr()Return extra information about parameters for representation/logging.
fit(y[, X])Fit transformer, i.e. determine center and scale of data.
fit_transform(X[, y])Fit to data, then transform it.
get_metadata_routing()Get metadata routing of this object.
get_parameters(*args, **kwargs)Returns parameters that were used for encoding.
get_params([deep])Get parameters for this estimator.
get_transform(transformation)Return transformation functions.
inverse_preprocess(y)Inverse preprocess re-scaled data (e.g. take exp).
inverse_transform(y)Inverse scale.
preprocess(y)Preprocess input data (e.g. take log).
set_output(*[, transform])Set output container.
set_params(**params)Set the parameters of this estimator.
set_transform_request(*[, return_norm, ...])Configure whether metadata should be requested to be passed to the
transformmethod.transform(y[, X, return_norm, target_scale])Scale input data.
Attributes
TRANSFORMATIONS- fit(y: DataFrame | ndarray | Tensor, X: DataFrame = None)[source]#
Fit transformer, i.e. determine center and scale of data
- Parameters:
y (Union[pd.Series, np.ndarray, torch.Tensor]) – input data
- Returns:
MultiNormalizer
- Return type:
self
- get_parameters(*args, **kwargs) list[Tensor][source]#
Returns parameters that were used for encoding.
- Returns:
First element is center of data and second is scale
- Return type:
List[torch.Tensor]
- set_transform_request(*, return_norm: bool | None | str = '$UNCHANGED$', target_scale: bool | None | str = '$UNCHANGED$') MultiNormalizer#
Configure whether metadata should be requested to be passed to the
transformmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed totransformif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it totransform.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- Parameters:
return_norm (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
return_normparameter intransform.target_scale (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
target_scaleparameter intransform.
- Returns:
self – The updated object.
- Return type:
object
- transform(y: DataFrame | ndarray | Tensor, X: DataFrame = None, return_norm: bool = False, target_scale: list[Tensor] = None) list[tuple[ndarray | Tensor, ndarray]] | list[ndarray | Tensor][source]#
Scale input data.
- Parameters:
y (Union[pd.DataFrame, np.ndarray, torch.Tensor]) – data to scale
X (pd.DataFrame) – dataframe with
groupscolumns. Only necessary ifGroupNormalizeris among normalizersreturn_norm (bool, optional) – If to return . Defaults to False.
target_scale (List[torch.Tensor]) – target scale to use instead of fitted center and scale
- Returns:
List of scaled data, if
return_norm=True, returns also scales as second element- Return type:
Union[List[Tuple[Union[np.ndarray, torch.Tensor], np.ndarray]], List[Union[np.ndarray, torch.Tensor]]]