pywatts.modules.generation package

Submodules

pywatts.modules.generation.anomaly_generation_module module

class pywatts.modules.generation.anomaly_generation_module.AnomalyGeneration(name: str = 'AnomalyGeneration', count: Union[int, float] = 1, anomaly: str = 'gap', anomaly_params: Dict[KT, VT] = {}, length_params: Dict[KT, VT] = {}, label: Optional[int] = None, seed: int = 0)

Bases: pywatts_pipeline.core.transformer.base.BaseTransformer

Module for generating anomalies. Anomalies depend on their type and their length. Examples are not-a-number anomalies or constant values over a certain period of time.

set_params(**kwargs)

Set parameters of the anomaly generation module.

Parameters:
  • count (Optional[Union[int, float]]) – Number of anomalies to be inserted. It can be a percentage value (float) or a whole number (int).
  • anomaly (Optional[str]) – Type of anomaly to be inserted, e.g. ‘gap’, ‘outlier’, ‘negate’ or ‘constant.
  • anomaly_params (Optional[Dict]) – JSON Dict containing anomaly method parameters.
  • length_params (Optional[Dict]) – JSON Dict containing length distribution parameters.
  • label (Optional[int]) – Label to use for the anomaly labels (default None).
  • seed (Optional[int]) – Seed to be used by the random generator.
transform(x: xarray.core.dataarray.DataArray, **kwargs) → Dict[str, xarray.core.dataarray.DataArray]

Finally insert anomalies using the given parameters.

Parameters:
  • x (xr.DataArray) – Array to be transformed.
  • labels (xr.DataArray) – Array of anomaly labels
Returns:

Transformed array.

Return type:

Dict[str, xr.DataArray]

pywatts.modules.generation.energy_anomaly_generation_module module

class pywatts.modules.generation.energy_anomaly_generation_module.EnergyAnomalyGeneration(name: str = 'AnomalyGeneration', count: Union[int, float] = 1, anomaly: str = 'gap', anomaly_params: Dict[KT, VT] = {}, length_params: Dict[KT, VT] = {}, label: Optional[int] = None, seed: int = 0)

Bases: pywatts.modules.generation.anomaly_generation_module.AnomalyGeneration

Module to define specific anomalies to be inserted into an energy time series.

pywatts.modules.generation.power_anomaly_generation_module module

class pywatts.modules.generation.power_anomaly_generation_module.PowerAnomalyGeneration(name: str = 'AnomalyGeneration', count: Union[int, float] = 1, anomaly: str = 'gap', anomaly_params: Dict[KT, VT] = {}, length_params: Dict[KT, VT] = {}, label: Optional[int] = None, seed: int = 0)

Bases: pywatts.modules.generation.anomaly_generation_module.AnomalyGeneration

Module to define specific anomalies to be inserted into a power time series.

pywatts.modules.generation.synthetic_concept_drift module

class pywatts.modules.generation.synthetic_concept_drift.DriftInformation(manipulator: Callable[[int], numpy.array], position: pandas._libs.tslibs.timestamps.Timestamp, length: int)

Bases: object

The drift information describe one concept drift. :param manipulator: A callable that returns a one-dimensional numpy array which is added on the time series. :type manipulator: Callable[[int], np.array] :param position: The start position of the concept drift. :type position: pd.Timestamp :param length: The length of the inserted concept drift. :type length: int

get_drift()

This function returns the array that contains the concept drift. :return: The array containing the data for inserting a concept drift. :rtype: np.array

class pywatts.modules.generation.synthetic_concept_drift.SyntheticConcecptDriftInsertion(drift_information: List[pywatts.modules.generation.synthetic_concept_drift.DriftInformation], name: str = 'Concept Drift Generation')

Bases: pywatts_pipeline.core.transformer.base.BaseTransformer

Module for inserting synthetic concept drifts in the input time series. The inserted concept drifts are specified by the drift information. :param drift_information: A list of drift information. Each drift information specifies the position, the kind, and

the length of a concept drift.
classmethod load(load_information: Dict[KT, VT])

Uses the data in load_information for restoring the state of the module.

Parameters:load_information (Dict) – The data needed for restoring the state of the module
Returns:The restored module
Return type:Base
save(fm: pywatts_pipeline.core.util.filemanager.FileManager) → Dict[KT, VT]

Saves the modules and the state of the module and returns a dictionary containing the relevant information.

Parameters:fm (FileManager) – the filemanager which can be used by the module for saving information about the module.
Returns:A dictionary containing the information needed for restoring the module

:rtype:Dict

transform(x: xarray.core.dataarray.DataArray) → xarray.core.dataarray.DataArray

This method inserts the concept drift in the input time series. :param x: Array to be transformed. :type x: xr.DataArray :return: Transformed array. :rtype: Dict[str, xr.DataArray]

pywatts.modules.generation.unusual_behaviour_generation module

class pywatts.modules.generation.unusual_behaviour_generation.UnusualBehaviour(name: str = 'AnomalyGeneration', count: Union[int, float] = 1, anomaly: str = 'gap', anomaly_params: Dict[KT, VT] = {}, length_params: Dict[KT, VT] = {}, label: Optional[int] = None, seed: int = 0)

Bases: pywatts.modules.generation.anomaly_generation_module.AnomalyGeneration

Module to define specific anomalies to be inserted into a power time series.

Module contents