ocpa.algo.predictive_monitoring package

Subpackages

Submodules

ocpa.algo.predictive_monitoring.factory module

ocpa.algo.predictive_monitoring.factory.apply(ocel, event_based_features=[], execution_based_features=[], event_attributes=[], event_object_attributes=[], execution_object_attributes=[])

Creates a Feature Storage object from the object-centric event log considering the desired features. Features are passed as a list of Tuples, containing first the function to calculate the feature and second a tuple of parameter values (can be empty). The feature functions need to have a signature of (event_id (int), ocel, parameters (Tuple)) for event-based features or (case (int), ocel, parameters (Tuple)) for execution-based features. A set of predefined feature functions can be found in event-based features and event-based features.

Parameters
  • ocel (OCEL) – Object-centric event log

  • event_based_features (Tuple(function, Tuple())) – list of event-based features. Each feature is a tuple of the function and parameter tuple

  • execution_based_features (Tuple(function, Tuple())) – list of execution-based features. Each feature is a tuple of the function and parameter tuple

  • event_attributes (str) – List of event attributes to be added to an event’s features.

  • event_object_attributes – To be added in future

  • execution_object_attributes – To be added in future

Returns

Feature Storage

Return type

Feature Storage

ocpa.algo.predictive_monitoring.obj module

class ocpa.algo.predictive_monitoring.obj.Feature_Storage(event_features, execution_features, ocel)

Bases: object

The Feature Storage class stores features extracted for an obejct-centric event log. It stores it in form of feature graphs: Each feature graph contains the features for a process execution in form of labeled nodes and graph properties. Furthermore, the class provides the possibility to create a training/testing split on the basis of the graphs.

class Feature_Graph(case_id, graph, ocel)

Bases: object

class Edge(source, target, objects)

Bases: object

add_attribute(key, value)
property attributes
property objects
property source
property target
class Node(event_id, objects)

Bases: object

add_attribute(key, value)
property attributes
property event_id
property objects
add_attribute(key, value)
property attributes
property edges
get_edge_from_event_ids(source, target)
get_node_from_event_id(event_id)
property nodes
property objects
replace_edges(edges)
add_feature_graph(feature_graph)
property event_features
property execution_features
extract_normalized_train_test_split(test_size, state=1)

Splits and normalizes the feature storage. Each split is normalized according to it’s member, i.e., the testing set is not normalized with information of the training set. The splitting information is stored in form of index lists as properties of the feature storage object. :param test_size: Between 0 and 1, indicates the share of the data that should go to the test set. :type test_size: float

Parameters

state (int) – random state of the splitting. Can be used to reproduce splits

property feature_graphs
property scaler
property test_indices
property training_indices

ocpa.algo.predictive_monitoring.sequential module

ocpa.algo.predictive_monitoring.sequential.construct_k_dataset(sequences, k, features, target)
ocpa.algo.predictive_monitoring.sequential.construct_sequence(feature_storage, index_list='all')

Constructs a sequential respresentation of the feature_graphs of a feature storage.

Parameters
  • feature_storage (Feature Storage) – Feature storage to construct a sequential encoding from.

  • index_list ("all" or list(int)) – list of indices to be encoded as sequences. Default is “all”

Returns

List of sequential encodings: Each sequential encoding is a sequence of feature dicts.

Return type

list(list(dict))

ocpa.algo.predictive_monitoring.tabular module

ocpa.algo.predictive_monitoring.tabular.construct_table(feature_storage, index_list='all')

Constructs a tabular encoding of the feature_graphs of a feature storage. Each event is transformed into one row of the table with the columns being the event’s extracted features.

Parameters
  • feature_storage (Feature Storage) – Feature storage to construct a sequential encoding from.

  • index_list ("all" or list(int)) – list of indices to be encoded as sequences. Default is “all”

Returns

List of sequential encodings: Each sequential encoding is a sequence of feature dicts.

Return type

list(list(dict))

ocpa.algo.predictive_monitoring.time_series module

ocpa.algo.predictive_monitoring.time_series.construct_time_series(ocel, w, feat_events, feat_cases, f_in=<function start>)

Constructs a time series from an object-centric event log. :param ocel: Object-Centric Event Log :type ocel: OCEL

Parameters
  • w (time.timedelta) – window size

  • feat_events (Tuple(func, Tuple(func, Tuple()))) – Features to be calculated on an event level. Tuple of a function to aggregate the values for a window and the feature function. For the definition of a function please see feature extraction

  • feat_cases – Features to be calculated on a process_execution (case) level. Tuple of a function to aggregate the values for a window and the feature function. For the definition of a function please see feature extraction

  • f_in (func) – Function to assign events to time windows. Possible functions can be found in time_filtering:, e.g., by start timestamp of the process execution:

Returns

time series as list of dictionaries of values, list of time stamps for each index

Return type

list(dict))

Module contents