pm4py.algo.transformation.log_to_features.variants package

Submodules

pm4py.algo.transformation.log_to_features.variants.event_based module

class pm4py.algo.transformation.log_to_features.variants.event_based.Parameters(value)[source]

Bases: enum.Enum

An enumeration.

FEATURE_NAMES = 'feature_names'
MAX_NUM_DIFF_STR_VALUES = 'max_num_diff_str_values'
MIN_NUM_DIFF_STR_VALUES = 'min_num_diff_str_values'
NUM_EVENT_ATTRIBUTES = 'num_ev_attr'
STR_EVENT_ATTRIBUTES = 'str_ev_attr'
pm4py.algo.transformation.log_to_features.variants.event_based.apply(log: pm4py.objects.log.obj.EventLog, parameters: Optional[Dict[str, Any]] = None) → Tuple[Any, List[str]][source]

Extracts all the features for the traces of an event log (each trace becomes a vector of vectors, where each event has its own vector)

Parameters
  • log – Event log

  • parameters

    Parameters of the algorithm, including:
    • STR_EVENT_ATTRIBUTES => string event attributes to consider in the features extraction

    • NUM_EVENT_ATTRIBUTES => numeric event attributes to consider in the features extraction

    • FEATURE_NAMES => features to consider (in the given order)

Returns

  • data – Data to provide for decision tree learning

  • feature_names – Names of the features, in order

pm4py.algo.transformation.log_to_features.variants.event_based.extract_all_ev_features_names_from_log(log: pm4py.objects.log.obj.EventLog, str_ev_attr: List[str], num_ev_attr: List[str], parameters: Optional[Dict[str, Any]] = None) → List[str][source]

Extracts the feature names from an event log.

Parameters
  • log – Event log

  • str_ev_attr – (if provided) list of string event attributes to consider in extracting the feature names

  • num_ev_attr – (if provided) list of integer event attributes to consider in extracting the feature names

  • parameters

    Parameters, including:
    • MIN_NUM_DIFF_STR_VALUES => minimum number of distinct values to include an attribute as feature(s)

    • MAX_NUM_DIFF_STR_VALUES => maximum number of distinct values to include an attribute as feature(s)

Returns

List of feature names

Return type

feature_names

pm4py.algo.transformation.log_to_features.variants.event_based.extract_features(log: pm4py.objects.log.obj.EventLog, feature_names: List[str], parameters: Optional[Dict[str, Any]] = None) → Tuple[Any, List[str]][source]

Extracts the matrix of the features from an event log

Parameters
  • log – Event log

  • feature_names – Features to consider (in the given order)

Returns

  • data – Data to provide for decision tree learning

  • feature_names – Names of the features, in order

pm4py.algo.transformation.log_to_features.variants.trace_based module

class pm4py.algo.transformation.log_to_features.variants.trace_based.Parameters(value)[source]

Bases: enum.Enum

An enumeration.

ENABLE_ACTIVITY_DEF_REPRESENTATION = 'enable_activity_def_representation'
ENABLE_SUCC_DEF_REPRESENTATION = 'enable_succ_def_representation'
FEATURE_NAMES = 'feature_names'
NUM_EVENT_ATTRIBUTES = 'num_ev_attr'
NUM_TRACE_ATTRIBUTES = 'num_tr_attr'
STR_EVENT_ATTRIBUTES = 'str_ev_attr'
STR_EVSUCC_ATTRIBUTES = 'str_evsucc_attr'
STR_TRACE_ATTRIBUTES = 'str_tr_attr'
pm4py.algo.transformation.log_to_features.variants.trace_based.apply(log: pm4py.objects.log.obj.EventLog, parameters: Optional[Dict[str, Any]] = None) → Tuple[Any, List[str]][source]

Extract the features from an event log (a vector for each trace)

Parameters
  • log – Log

  • parameters – Parameters of the algorithm, including: - STR_TRACE_ATTRIBUTES => string trace attributes to consider in the features extraction - STR_EVENT_ATTRIBUTES => string event attributes to consider in the features extraction - NUM_TRACE_ATTRIBUTES => numeric trace attributes to consider in the features extraction - NUM_EVENT_ATTRIBUTES => numeric event attributes to consider in the features extraction - STR_EVSUCC_ATTRIBUTES => succession of event attributes to consider in the features extraction - FEATURE_NAMES => features to consider (in the given order)

Returns

  • data – Data to provide for decision tree learning

  • feature_names – Names of the features, in order

pm4py.algo.transformation.log_to_features.variants.trace_based.get_all_string_event_attribute_values(log: pm4py.objects.log.obj.EventLog, event_attribute: str) → List[str][source]

Get all the representations for all the traces of the log associated to a string event attribute values

Parameters
  • log – Trace of the log

  • event_attribute – Event attribute to consider

Returns

All feature names present for the given attribute in the given log

Return type

values

pm4py.algo.transformation.log_to_features.variants.trace_based.get_all_string_event_succession_attribute_values(log: pm4py.objects.log.obj.EventLog, event_attribute: str) → List[str][source]

Get all the representations for all the traces of the log associated to a string event attribute succession values

Parameters
  • log – Trace of the log

  • event_attribute – Event attribute to consider

Returns

All feature names present for the given attribute succession in the given log

Return type

values

pm4py.algo.transformation.log_to_features.variants.trace_based.get_all_string_trace_attribute_values(log: pm4py.objects.log.obj.EventLog, trace_attribute: str) → List[str][source]

Get all string trace attribute values representations for a log

Parameters
  • log – Trace log

  • trace_attribute – Attribute of the trace to consider

Returns

List containing for each trace a representation of the feature name associated to the attribute

Return type

list

pm4py.algo.transformation.log_to_features.variants.trace_based.get_default_representation(log: pm4py.objects.log.obj.EventLog, parameters: Optional[Dict[str, Any]] = None, feature_names: Optional[List[str]] = None) → Tuple[Any, List[str]][source]

Gets the default data representation of an event log (for process tree building)

Parameters
  • log – Trace log

  • parameters – Possible parameters of the algorithm

  • feature_names – (If provided) Feature to use in the representation of the log

Returns

  • data – Data to provide for decision tree learning

  • feature_names – Names of the features, in order

pm4py.algo.transformation.log_to_features.variants.trace_based.get_default_representation_with_attribute_names(log: pm4py.objects.log.obj.EventLog, parameters: Optional[Dict[str, Any]] = None, feature_names: Optional[List[str]] = None) → Tuple[Any, List[str], List[str], List[str], List[str], List[str]][source]

Gets the default data representation of an event log (for process tree building) returning also the attribute names

Parameters
  • log – Trace log

  • parameters – Possible parameters of the algorithm

  • feature_names – (If provided) Feature to use in the representation of the log

Returns

  • data – Data to provide for decision tree learning

  • feature_names – Names of the features, in order

pm4py.algo.transformation.log_to_features.variants.trace_based.get_numeric_event_attribute_rep(event_attribute: str) → str[source]

Get the feature name associated to a numeric event attribute

Parameters

event_attribute – Name of the event attribute

Returns

Name of the feature

Return type

feature_name

pm4py.algo.transformation.log_to_features.variants.trace_based.get_numeric_event_attribute_value(event: pm4py.objects.log.obj.Event, event_attribute: str) → Union[int, float][source]

Get the value of a numeric event attribute from a given event

Parameters

event – Event

Returns

Value of the numeric event attribute for the given event

Return type

value

pm4py.algo.transformation.log_to_features.variants.trace_based.get_numeric_event_attribute_value_trace(trace: pm4py.objects.log.obj.Trace, event_attribute: str) → Union[int, float][source]

Get the value of the last occurrence of a numeric event attribute given a trace

Parameters

trace – Trace of the log

Returns

Value of the last occurrence of a numeric trace attribute for the given trace

Return type

value

pm4py.algo.transformation.log_to_features.variants.trace_based.get_numeric_trace_attribute_rep(trace_attribute: str) → str[source]

Get the feature name associated to a numeric trace attribute

Parameters

trace_attribute – Name of the trace attribute

Returns

Name of the feature

Return type

feature_name

pm4py.algo.transformation.log_to_features.variants.trace_based.get_numeric_trace_attribute_value(trace: pm4py.objects.log.obj.Trace, trace_attribute: str) → Union[int, float][source]

Get the value of a numeric trace attribute from a given trace

Parameters

trace – Trace of the log

Returns

Value of the numeric trace attribute for the given trace

Return type

value

pm4py.algo.transformation.log_to_features.variants.trace_based.get_representation(log: pm4py.objects.log.obj.EventLog, str_tr_attr: List[str], str_ev_attr: List[str], num_tr_attr: List[str], num_ev_attr: List[str], str_evsucc_attr: Optional[List[str]] = None, feature_names: Optional[List[str]] = None) → Tuple[Any, List[str]][source]

Get a representation of the event log that is suited for the data part of the decision tree learning

NOTE: this function only encodes the last value seen for each attribute

Parameters
  • log – Trace log

  • str_tr_attr – List of string trace attributes to consider in data vector creation

  • str_ev_attr – List of string event attributes to consider in data vector creation

  • num_tr_attr – List of numeric trace attributes to consider in data vector creation

  • num_ev_attr – List of numeric event attributes to consider in data vector creation

  • str_evsucc_attr – List of attributes succession of values to consider in data vector creation

  • feature_names – (If provided) Feature to use in the representation of the log

Returns

  • data – Data to provide for decision tree learning

  • feature_names – Names of the features, in order

pm4py.algo.transformation.log_to_features.variants.trace_based.get_string_event_attribute_rep(event: pm4py.objects.log.obj.Event, event_attribute: str) → str[source]

Get a representation of the feature name associated to a string event attribute value

Parameters
  • event – Single event of a trace

  • event_attribute – Event attribute to consider

Returns

Representation of the feature name associated to a string event attribute value

Return type

rep

pm4py.algo.transformation.log_to_features.variants.trace_based.get_string_event_attribute_succession_rep(event1: pm4py.objects.log.obj.Event, event2: pm4py.objects.log.obj.Event, event_attribute: str) → str[source]

Get a representation of the feature name associated to a string event attribute value

Parameters
  • event1 – First event of the succession

  • event2 – Second event of the succession

  • event_attribute – Event attribute to consider

Returns

Representation of the feature name associated to a string event attribute value

Return type

rep

pm4py.algo.transformation.log_to_features.variants.trace_based.get_string_trace_attribute_rep(trace: pm4py.objects.log.obj.Trace, trace_attribute: str) → str[source]

Get a representation of the feature name associated to a string trace attribute value

Parameters
  • trace – Trace of the log

  • trace_attribute – Attribute of the trace to consider

Returns

Representation of the feature name associated to a string trace attribute value

Return type

rep

pm4py.algo.transformation.log_to_features.variants.trace_based.get_values_event_attribute_for_trace(trace: pm4py.objects.log.obj.Trace, event_attribute: str) → Set[str][source]

Get all the representations for the events of a trace associated to a string event attribute values

Parameters
  • trace – Trace of the log

  • event_attribute – Event attribute to consider

Returns

All feature names present for the given attribute in the given trace

Return type

values

pm4py.algo.transformation.log_to_features.variants.trace_based.get_values_event_attribute_succession_for_trace(trace: pm4py.objects.log.obj.Trace, event_attribute: str) → Set[str][source]

Get all the representations for the events of a trace associated to a string event attribute succession values

Parameters
  • trace – Trace of the log

  • event_attribute – Event attribute to consider

Returns

All feature names present for the given attribute succession in the given trace

Return type

values

Module contents