pm4py.algo.decision_mining package

Submodules

pm4py.algo.decision_mining.algorithm module

class pm4py.algo.decision_mining.algorithm.Parameters(value)[source]

Bases: enum.Enum

An enumeration.

ACTIVITY_KEY = 'pm4py:param:activity_key'
pm4py.algo.decision_mining.algorithm.apply(log, net, initial_marking, final_marking, decision_point=None, attributes=None, parameters=None)[source]

Gets the essential information (features, target class and names of the target class) in order to learn a classifier

Parameters
  • log – Event log

  • net – Petri net

  • initial_marking – Initial marking

  • final_marking – Final marking

  • decision_point – Point of the process in which a decision happens: - if not specified, the method crashes, but provides a list of possible decision points - if specified, the method goes on and produce the decision tree

  • attributes – Attributes of the log. If not specified, then an automatic attribute selection is performed.

  • parameters – Parameters of the algorithm

Returns

  • X – features

  • y – Target class

  • class_name – Target class names

pm4py.algo.decision_mining.algorithm.encode_target(df, target_column)[source]

Add column to df with integers for the target. Method taken from: http://chrisstrelioff.ws/sandbox/2015/06/08/decision_trees_in_python_with_scikit_learn_and_pandas.html :Parameters: * df – pandas DataFrame.

  • target_column – column to map to int, producing – new Target column.

Returns

  • df_mod – modified DataFrame.

  • targets – list of target names.

pm4py.algo.decision_mining.algorithm.get_attributes(log, decision_points, attributes, use_trace_attributes, trace_attributes, k, net, initial_marking, final_marking, decision_points_names, parameters=None)[source]
This method aims to construct for each decision place a table where for each decision place a list if given with the

label of the later decision and as value the given attributes

Parameters
  • log – Log on which the method is applied

  • alignments – Computed alignments for a log and a model

  • decision_points – Places that have multiple outgoing arcs

  • attributes – Attributes that are considered

  • use_trace_attributes – If trace attributes have to be considered or not

  • trace_attributes – List of trace attributes that are considered

  • k – Taking k last activities into account

Returns

Dictionary that has as keys the decision places. The value for this key is a list.

The content of these lists are tuples. The first element of these tuples is information regrading the attributes, the second element of these tuples is the transition which chosen in a decision.

pm4py.algo.decision_mining.algorithm.get_decision_points(net, labels=False, pre_decision_points=None, parameters=None)[source]

The goal is to get all decision places. These are places where there are at least two outgoing arcs. :param net: Petri Net where decision points are discovered (places with at least two outgoing arcs) :param labels: If someone wants to get the labels of the transitions after a decision point and not the “ID” :return:

pm4py.algo.decision_mining.algorithm.get_decision_tree(log, net, initial_marking, final_marking, decision_point=None, attributes=None, parameters=None)[source]

Gets a decision tree classifier on a specific point of the model

Parameters
  • log – Event log

  • net – Petri net

  • initial_marking – Initial marking

  • final_marking – Final marking

  • decision_point – Point of the process in which a decision happens: - if not specified, the method crashes, but provides a list of possible decision points - if specified, the method goes on and produce the decision tree

  • attributes – Attributes of the log. If not specified, then an automatic attribute selection is performed.

  • parameters – Parameters of the algorithm

Returns

  • clf – Decision tree

  • feature_names – The names of the features

  • classes – The classes

pm4py.algo.decision_mining.algorithm.get_decisions_table(log0, net, initial_marking, final_marking, attributes=None, use_trace_attributes=False, k=1, pre_decision_points=None, trace_attributes=None, parameters=None)[source]

Gets a decision table out of a log and an accepting Petri net

Parameters
  • log0 – Event log

  • net – Petri net

  • initial_marking – Initial marking

  • final_marking – Final marking

  • attributes – List of attributes which are considered (if not provided, all the attributes are considered)

  • use_trace_attributes – Include trace attributes in the decision table

  • k – Number that determines the number of last activities to take into account

  • pre_decision_points – List of Strings of place Names that have to be considered as decision points. If not provided, the decision points are inferred from the Petri net

  • trace_attributes – List of trace attributes to consider

  • parameters – Possible parameters of the algorithm

Returns

  • I – decision table

  • decision_points – The decision points as places of the Petri net, which are the keys of a dictionary having as values the list of transitions that are target

pm4py.algo.decision_mining.algorithm.prepare_attributes(attributes)[source]

Method that “e_” in front of every attribute if trace attributes are considered. :param attributes: List of event attributes that the user wants to consider. :return: list of edited attribute names

pm4py.algo.decision_mining.algorithm.prepare_event_log(log)[source]

If trace attributes are considered, it is possible that trace attributes have the same name as event attributes. To tackle this issue, the attributes get renamed. For trace attributes, we add “t_” at the beginning of the dictionary keys. For event attributes, we add “e_” at the beginning of the dict keys. :param log: :return:

pm4py.algo.decision_mining.algorithm.simplify_token_replay(replay)[source]

Module contents