API
Training
This module is responsible for the training phase of ECS Event Abstraction.
- ecsea.training.train_model(low_level_log: DataFrame, high_level_log: DataFrame, parameter: Dict[str, Any] | None = None, show_progress=True) Model
Train a model by “comparing” a low-level and a high-level event log. The low-level and high-level traces should contain the same traces with the same IDs as “concept:name” attribute.
- Parameters:
low_level_log – the low-level event log
high_level_log – the high-level event log
parameter – additional training parameter
show_progress – show a progress bar
- Returns:
the Model
- ecsea.training.validate_logs(low_level_log: List[List[Dict[Hashable, Any]]], high_level_log: List[List[Dict[Hashable, Any]]])
Tests if the low-level and the high-level log are suitable for this ecs event abstraction approach. The function raises a ValueError, if the high-level log contains a trace, which is not contained in the low-level log.
- Parameters:
low_level_log – the low level log
high_level_log – the high level log
- Returns:
nothing
Parameter
This module provides functions for the ecsea parameter.
- exception ecsea.parameter.EcsEaParameterError(parameter_key, message)
- class ecsea.parameter.ParameterKey(*values)
- ecsea.parameter.get_default_parameter() Dict
Returns a dict of default parameters for the ECS-EA training algorithm.
- ecsea.parameter.validate_parameter(parameter: Dict)
Validate the parameters and throws a Value Error, if parameters does not fit the constraints.
Model
- class ecsea.model.Model
Defines an ECSEA model, that was trained with a low-level and a high-level log. Can be applied with a new low-level log to create a high-level log.
- export(path: str)
Export the model to the given file path.
- Parameters:
path – The path for the model file
- static load(path: str) Model
Load the model from the given file path.
- Parameters:
path – The path for the model file
- pretty_string(show_activities=True, show_accuracy_information=False, show_parameter=True, show_mapping_information=True, show_mapping_statistics=True) str
Create a string representation of the model the information stored in this model.
- Parameters:
show_activities – Show the low-level and high-level activities stored in this model
show_accuracy_information – Show the accuracy information from the training phase
show_parameter – Show the parameter for the training & application phase
show_mapping_information – Show the mapping information stored in the model
show_mapping_statistics – Show the statistics for the mapping information
Application
This module is responsible for the application phase of ECS Event Abstraction.
- class ecsea.application.ApplicationResult(abstracted_log: pandas.core.frame.DataFrame, compression: float, runtime_ms: float)
- ecsea.application.apply(low_level_log: DataFrame, model: Model, show_progress=False) ApplicationResult
Converts a low-level event log into a high-level event log using a trained model. This model was created by training it with a low-level event log and the corresponding high-level event log.
- Parameters:
low_level_log – the low-level event log
model – the trained model
show_progress – show a progress bar
- Returns:
the abstracted event log
- ecsea.application.apply_trace(low_level_trace: List[Dict[Hashable, Any]], model: Model) List[Dict[Hashable, Any]]
Convert a single trace into a high-level trace
- Parameters:
low_level_trace – the low-level trace
model – the Model
- Returns:
a new high-level trace based on the converted low-level trace
- ecsea.application.apply_trace_old(low_level_trace: List[Dict[Hashable, Any]], model: Model) List[Dict[Hashable, Any]]
Convert a single trace into a high-level trace
- Parameters:
low_level_trace – the low-level trace
model – the Model
- Returns:
a new high-level trace based on the converted low-level trace
Optimize
This module is responsible for optimizing the training phase of ECS Event Abstraction.
- ecsea.optimize.optimize(low_level_log, high_level_log, parameter: Dict[str, Any], accuracy_attribute='train_accuracy_dl', n_trials=100, timeout=None, *, optimize_time_span=True, optimize_timestamp_merge=True, optimize_mapping_threshold=True, min_time_span=500, max_time_span=100000, min_mapping_threshold=0.0, max_mapping_threshold=3.0)
Optimize the model by performing a hyperparamter optimization.
- Parameters:
low_level_log – The low-level log
high_level_log – The high-level log
parameter – the default parameter for the optimization
accuracy_attribute – the model attribute for the accuracy {see POSSIBLE_ACCURACY_ATTRIBUTES}
n_trials – the number of trials
timeout – the timeout, if None -> No timeout
optimize_time_span – Optimize the time span; default: True
optimize_timestamp_merge – Optimize the timestamp_merge; default: True
optimize_mapping_threshold – Optimize the mapping_threshold; default: True
min_time_span – The upper bound for the time_span parameter
max_time_span – The lower bound for the time_span parameter
min_mapping_threshold – The lower bound for the mapping_threshold (should be >=0
max_mapping_threshold – The upper bound for the mapping_threshold
- Returns:
The best params for the best model