pywatts.modules.postprocessing package¶
Submodules¶
pywatts.modules.postprocessing.ensemble module¶
-
class
pywatts.modules.postprocessing.ensemble.
Ensemble
(weights: Union[str, list] = None, k_best: Union[str, int] = None, loss_metric: pywatts.modules.postprocessing.ensemble.Ensemble.LossMetric = <LossMetric.RMSE: 1>, name: str = 'Ensemble')¶ Bases:
pywatts_pipeline.core.transformer.base.BaseEstimator
Aggregation step to ensemble the given time series, ether by simple or weighted averaging. By default simple averaging is applied.
-
class
LossMetric
¶ Bases:
enum.IntEnum
Enum which contains the different loss metrics of the ensemble module.
-
MAE
= 2¶
-
RMSE
= 1¶
-
-
fit
(**kwargs)¶ Fit the model, e.g. optimize parameters such that model(x) = y
Parameters: kwargs – key word arguments as input. If the key word starts with target, then it is a target variable. Returns:
-
transform
(**kwargs) → xarray.core.dataarray.DataArray¶ Ensemble the given time series by simple or weighted averaging. :return: Xarray dataset aggregated by simple or weighted averaging. :rtype: xr.DataArray
-
class
pywatts.modules.postprocessing.merger module¶
-
class
pywatts.modules.postprocessing.merger.
Merger
(name: str = 'merger', method: Union[str, int] = 'mean')¶ Bases:
pywatts_pipeline.core.transformer.base.BaseTransformer
The merger reduces a two-dimensional time series with multiple values per time step to a univariate time series. The first dimension of the input time series is the time index. The second dimension looks n-1 steps into the past so it contains the following values: x(t - n + 1), x(t - n + 2), .. x(t), where t is the current time index.
Parameters: - name (str) – The name of the module
- method (Union[str,int]) – The method indicates the merging method. Method can be ‘mean’, ‘median’, or an integer. For each time step, the ‘mean’ method takes all values of the input time series that correspond to the same time, and calculates the mean. For each time step, the ‘median’ method takes all values of the input time series that correspond to the same time and calculates the median. If the method is an integer k, the k-th value in the second dimension is taken for each time step. If k is negative, the k-th values in the second dimension before the last are selected. If the absolute value of k is greater than the size of the horizon dimension, then the value is clipped.
Raises: WrongParameterException – If the method is not an integer, ‘mean’, or ‘median’
-
set_params
(method: Union[str, int] = None)¶ Set parameters for the Merger module. :param method: :type method: Union[str,int] :raises WrongParameterException: If the method is not an integer, ‘mean’, or ‘median’
-
transform
(x: xarray.core.dataarray.DataArray) → xarray.core.dataarray.DataArray¶ Merge the given time series by mean, median or selecting one specific value. :return: DataArray of the resulting merged time series. :rtype: xr.DataArray