pm4py.ml.extract_target_vector#

pm4py.ml.extract_target_vector(log: EventLog | DataFrame, variant: str, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') Tuple[Any, List[str]][source]#

Extracts from a log object the target vector for a specific ML use case (next activity, next time, remaining time)

Parameters:
  • log – log object (event log / Pandas dataframe)

  • variant (str) – variant of the algorithm to be used: next_activity, next_time, remaining_time

  • activity_key (str) – the attribute to be used as activity

  • timestamp_key (str) – the attribute to be used as timestamp

  • case_id_key (str) – the attribute to be used as case identifier

Return type:

Tuple[Any, List[str]]

import pm4py

vector_next_act, class_next_act = pm4py.extract_target_vector(log, 'next_activity', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name')
vector_next_time, class_next_time = pm4py.extract_target_vector(log, 'next_time', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name')
vector_rem_time, class_rem_time = pm4py.extract_target_vector(log, 'remaining_time', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name')