Skip to content

Mapping functions

PdmContext.utils.mapping_functions.map_univariate_to_continuous

map_univariate_to_continuous()

Bases: map_base

Wrapper Class for mapping univariate time-series (defined as events with instant impact) to continuous time-series with same frequency as a target time-series.

map

map(target_series, occurrences, name)

For continuous data sources, we simply collect the values within the time window. Although the time window is the same for all sources, each source may have a different sample rate. To create a signal of the same size as target_series, we perform mean aggregation if a source has a higher sample rate than target_series, using the mean value of the data between each timestamp of the target_series.

Parameters:

target_series: Used to align sample rate of the continuous series.

occurrences: The univariate time series.

return: A time series with same size as target_series, to populate CD part of context.

PdmContext.utils.mapping_functions.map_isolated_to_continuous

map_isolated_to_continuous()

Bases: map_base

Wrapper Class for mapping isolated events (defined as events with instant impact) to continuous time-series.

map

map(target_series, occurrences, name)

Isolated events are discrete events that have an immediate impact on the behavior of the asset. To transform such events into a continuous representation, we start with a series of 0s as an initial signal and assign 1 to the position corresponding to the timestamps of the events. If the event timestamp does not match any target_series timestamps, it is mapped to the closest timestamp in target_series.

Parameters:

target_series: Used to align sample rate of the continuous series.

occurrences: Contain time stamps of the occurrences of an isolated type source.

return: A binary time series with same size as target_series, that models the occurrences of the provided isolated source, to populate CD part of the context.

PdmContext.utils.mapping_functions.map_configuration_to_continuous

map_configuration_to_continuous()

Bases: map_base

Wrapper Class for mapping configuration events (defined as events with constant impact) to continuous time-series.

map

map(target_series, occurrences, name)

Configuration events, refers to configuration changes or events that alter the state of the monitored asset. To transform these events into continuous signals, we start with a series of 0s, and after each occurrence of such an event, we add 1 to all the positions after the occurrence's timestamp

Parameters:

target_series: Used to align sample rate of the continuous series.

occurrences: Contain time stamps of the occurrences of an isolated type source.

return: A binary time series with same size as target_series, that models the occurrences of the provided Configuration source, to populate CD part of the context.

PdmContext.utils.mapping_functions.map_categorical_to_continuous

map_categorical_to_continuous()

Wrapper Class for mapping categorical to continuous time-series.

Categorical sources are usually sent only when they change, so the value active at the start of the context window may have been sent before the window. The ContextGenerator keeps the last value of such sources (mappers with keep_last_before_horizon=True) even when it is older than the context horizon.

map

map(target_series, occurrences, name)

This method is used to generate context time series of categorical type.

The way we do this is by generating a time series of each different category, by creating a zero and one series, similar to "isolated" type, by filling ones in the timestamps that each category appears. Finally, we create an additional series with the name state_{name}, having zeros until the occurrence of the last category, and filled with ones afterward.

Parameters:

target_series: Used to align sample rate.

occurrences: a list of tuple with timestamps and categorical value, refering to the observed value of a categorical source.

name: name of the categorical source.

return: A list of time-series to populate CD part of the context.