API Reference#
This page provides an overview of all public pm4py objects, functions, and methods.
Input (pm4py.read)#
pm4py supports importing the following standardized event data formats:
.xesfiles (xes-standard); general interchange format for event data.pm4py.read.read_xes()
In case an event log is stored as a .csv file, pandas can be used to directly import the event log as a data frame (docs).
.xes files are internally converted to a pandas dataframe, which is the default data structure used by all algorithms implemented in pm4py.
Additional file formats that are currently supported by PM4Py are:
.bpmnfiles; file format specifying process models in the BPMN process modeling formalismpm4py.read.read_bpmn()
.dfgfiles; file format specifying directly follows graphs (also referred to as process maps)pm4py.read.read_dfg()
.pnmlfiles; file format specifying Petri net modelspm4py.read.read_pnml()
.ptmlfiles; file format specifying Process Tree modelspm4py.read.read_ptml()
Importing object-centric event logs is possible given the following formats:
.csvspecificationpm4py.read.read_ocel_csv()
.jsonocelspecificationpm4py.read.read_ocel_json()
.xmlocelspecificationpm4py.read.read_ocel_xml()
.sqlitespecificationpm4py.read.read_ocel_sqlite()
Importing object-centric event logs (OCEL2.0) is possible given the following formats:
.xmlocelspecificationpm4py.read.read_ocel2_xml()
.sqlitespecificationpm4py.read.read_ocel2_sqlite()
.jsonocelspecificationpm4py.read.read_ocel2_json()
Output (pm4py.write)#
Similarly to event data importing, pm4py supports export functionalities to:
.bpmnfiles,pm4py.write.write_bpmn()
.dfgfiles,pm4py.write.write_dfg()
.pnmlfiles,pm4py.write.write_pnml()
.ptmlfiles,pm4py.write.write_ptml()
.xesfiles,pm4py.write.write_xes()
Exporting object-centric event logs is possible to the following formats:
.csvspecificationpm4py.write.write_ocel_csv()
.jsonocelspecificationpm4py.write.write_ocel_json()
.xmlocelspecificationpm4py.write.write_ocel_xml()
.sqlitespecificationpm4py.write.write_ocel_sqlite()
Exporting object-centric event logs (OCEL2.0) is possible to the following formats:
.xmlocelspecificationpm4py.write.write_ocel2_xml()
.sqlitespecificationpm4py.write.write_ocel2_sqlite()
.jsonocelspecificationpm4py.write.write_ocel2_json()
Conversion (pm4py.convert)#
Several conversions are available from/to different objects supported by pm4py.
The following conversions are currently available:
pm4py.convert.convert_to_bpmn()converts a process model to BPMN
pm4py.convert.convert_to_petri_net()converts a process model to a Petri net
pm4py.convert.convert_to_process_tree()converts a process model to a process tree
pm4py.convert.convert_to_powl()converts a process model to a POWL model
pm4py.convert.convert_to_reachability_graph()converts a process model to a reachability graph
pm4py.convert.convert_log_to_ocel()converts an event log to an object-centric event log
pm4py.convert.convert_log_to_networkx()converts a traditional event log (dataframe) to a directed graph (NetworkX)
pm4py.convert.convert_ocel_to_networkx()converts an object-centric event log to a directed graph (NetworkX)
pm4py.convert.convert_petri_net_to_networkx()converts an accepting Petri net to a directed graph (NetworkX)
pm4py.convert.convert_petri_net_type()changes the Petri net internal type
Process Discovery (pm4py.discovery)#
Process discovery algorithms discover a process model that describes the process execution, as stored in the event log.
PM4Py implements a variety of different process discovery algorithms.
These different algorithms return different kinds of models, i.e., models with imprecise execution semantics, procedural process models, and declarative process models.
Among the models with imprecise execution semantics, pm4py currently supports:
pm4py.discovery.discover_dfg(); discovers a directly follows graph annotated with frequency information (based on the log).
pm4py.discovery.discover_performance_dfg(); discovers a directly follows graph annotated with performance information (based on the log).
Among procedural process models, pm4py currently supports:
pm4py.discovery.discover_petri_net_alpha(); discovers a Petri net using the Alpha Miner algorithm.
pm4py.discovery.discover_petri_net_inductive(); discovers a Petri net using the Inductive Miner algorithm.
pm4py.discovery.discover_petri_net_heuristics(); discovers a Petri net using the Heuristics Miner algorithm.
pm4py.discovery.discover_petri_net_ilp(); discovers a Petri net using the ILP Miner algorithm.
pm4py.discovery.discover_process_tree_inductive(); discovers a process tree using the Inductive Miner algorithm.
pm4py.discovery.discover_bpmn_inductive(); discovers a BPMN model using the Inductive Miner algorithm.
pm4py.discovery.discover_heuristics_net(); discovers a heuristics net using the Heuristics Miner algorithm.
pm4py.discovery.discover_footprints(); discovers the footprints matrix of the log or the model.
pm4py.discovery.discover_powl(); discovers a partial order workflow language (POWL) model.
Among declarative process models, pm4py currently supports:
pm4py.discovery.discover_declare(); discovers a DECLARE model.
pm4py.discovery.discover_log_skeleton(); discovers a log skeleton.
pm4py.discovery.discover_temporal_profile(); discovers a temporal profile.
Conformance Checking (pm4py.conformance)#
Conformance checking techniques compare a process model with an event log of the same process. The goal is to check if the event log conforms to the model, and vice versa.
Among procedural process models, pm4py currently supports:
pm4py.conformance.conformance_diagnostics_token_based_replay(); token-based replay between the event log and a Petri net.
pm4py.conformance.conformance_diagnostics_alignments(); alignment-based replay between the event log and a Petri net.
pm4py.conformance.conformance_diagnostics_footprints(); footprints-based conformance diagnostics.
pm4py.conformance.fitness_token_based_replay(); evaluation of the fitness between an event log and a Petri net using token-based replay.
pm4py.conformance.fitness_alignments(); evaluation of the fitness between an event log and a Petri net using alignments.
pm4py.conformance.fitness_footprints(); evaluation of the fitness based on footprints.
pm4py.conformance.precision_token_based_replay(); evaluation of the precision between an event log and a Petri net using token-based replay.
pm4py.conformance.precision_alignments(); evaluation of the precision between an event log and a Petri net using alignments.
pm4py.conformance.precision_footprints(); evaluation of the precision based on footprints.
pm4py.conformance.replay_prefix_tbr(); replays a prefix (list of activities) on a given Petri net, using Token-Based Replay.
Among declarative process models, pm4py currently supports:
pm4py.conformance.conformance_log_skeleton(); conformance checking using the log skeleton.
pm4py.conformance.conformance_declare(); conformance checking using a DECLARE model.
pm4py.conformance.conformance_temporal_profile(); conformance checking using the temporal profile.
Visualization (pm4py.vis)#
The pm4py library implements basic visualizations of process models and statistics.
Among the on-screen visualizations, pm4py currently supports:
pm4py.vis.view_petri_net(); views a Petri net model.
pm4py.vis.view_dfg(); views a directly-follows graph annotated with the frequency.
pm4py.vis.view_performance_dfg(); views a directly-follows graph annotated with the performance.
pm4py.vis.view_process_tree(); views a process tree.
pm4py.vis.view_bpmn(); views a BPMN model.
pm4py.vis.view_heuristics_net(); views a heuristics net.
pm4py.vis.view_dotted_chart(); views a dotted chart.
pm4py.vis.view_sna(); views the results of a social network analysis.
pm4py.vis.view_case_duration_graph(); views the case duration graph.
pm4py.vis.view_events_per_time_graph(); views the events per time graph.
pm4py.vis.view_performance_spectrum(); views the performance spectrum.
pm4py.vis.view_events_distribution_graph(); views the events distribution graph.
pm4py.vis.view_ocdfg(); views an object-centric directly-follows graph.
pm4py.vis.view_ocpn(); views an object-centric Petri net.
pm4py.vis.view_object_graph(); views an object-based graph.
pm4py.vis.view_network_analysis(); views the results of a network analysis.
pm4py.vis.view_transition_system(); views the results of a transition system.
pm4py.vis.view_prefix_tree(); views a prefix tree.
pm4py.vis.view_alignments(); views the alignments table.
pm4py.vis.view_footprints(); views a footprints table.
pm4py.vis.view_powl(); views a POWL model.
We also offer some methods to store the visualizations on the disk:
pm4py.vis.save_vis_petri_net(); saves the visualization of a Petri net model.
pm4py.vis.save_vis_dfg(); saves the visualization of a directly-follows graph annotated with the frequency.
pm4py.vis.save_vis_performance_dfg(); saves the visualization of a directly-follows graph annotated with the performance.
pm4py.vis.save_vis_process_tree(); saves the visualization of a process tree.
pm4py.vis.save_vis_bpmn(); saves the visualization of a BPMN model.
pm4py.vis.save_vis_heuristics_net(); saves the visualization of a heuristics net.
pm4py.vis.save_vis_dotted_chart(); saves the visualization of a dotted chart.
pm4py.vis.save_vis_sna(); saves the visualization of the results of a social network analysis.
pm4py.vis.save_vis_case_duration_graph(); saves the visualization of the case duration graph.
pm4py.vis.save_vis_events_per_time_graph(); saves the visualization of the events per time graph.
pm4py.vis.save_vis_performance_spectrum(); saves the visualization of the performance spectrum.
pm4py.vis.save_vis_events_distribution_graph(); saves the visualization of the events distribution graph.
pm4py.vis.save_vis_ocdfg(); saves the visualization of an object-centric directly-follows graph.
pm4py.vis.save_vis_ocpn(); saves the visualization of an object-centric Petri net.
pm4py.vis.save_vis_object_graph(); saves the visualization of an object-based graph.
pm4py.vis.save_vis_network_analysis(); saves the visualization of the results of a network analysis.
pm4py.vis.save_vis_transition_system(); saves the visualization of the results of a transition system.
pm4py.vis.save_vis_prefix_tree(); saves the visualization of a prefix tree.
pm4py.vis.save_vis_alignments(); saves the visualization of the alignments table.
pm4py.vis.save_vis_footprints(); saves the visualization of the footprints table.
pm4py.vis.save_vis_powl(); saves the visualization of a POWL model.
Statistics (pm4py.stats)#
Different statistics that can be computed on top of event logs are proposed, including:
pm4py.stats.get_start_activities(); gets the start activities from the event log.
pm4py.stats.get_end_activities(); gets the end activities from the event log.
pm4py.stats.get_event_attributes(); gets the attributes at the event level of the event log.
pm4py.stats.get_trace_attributes(); gets the attributes at the trace level of the event log.
pm4py.stats.get_event_attribute_values(); gets the values of an attribute at the event level of the event log.
pm4py.stats.get_trace_attribute_values(); gets the values of an attribute at the trace level of the event log.
pm4py.stats.get_variants(); gets the variants of the event log.
pm4py.stats.split_by_process_variant(); splits an event log into sub-dataframes for each process variant.
pm4py.stats.get_variants_paths_duration(); method that associates to a log object a Pandas dataframe aggregated by variants and positions (inside the variant).
pm4py.stats.get_frequent_trace_segments(); gets the traces (segments of activities) of the event log.
pm4py.stats.get_case_arrival_average(); gets the average case arrival rate from the event log.
pm4py.stats.get_cycle_time(); gets the cycle time from the event log.
pm4py.stats.get_all_case_durations(); gets the list of case durations for the cases of the event log.
pm4py.stats.get_case_duration(); gets the case duration of a specific case in the log.
pm4py.stats.get_stochastic_language(); gets the stochastic language of an event log or a process model.
pm4py.stats.get_service_time(); gets the average service time per activity.
Filtering (pm4py.filtering)#
Filtering is the restriction of the event log to a subset of the behavior. Different methods are offered in PM4Py for traditional event logs (.xes, .csv), including:
pm4py.filtering.filter_start_activities(); filters the start activities of the event log.
pm4py.filtering.filter_end_activities(); filters the end activities of the event log.
pm4py.filtering.filter_event_attribute_values(); filters the values of an attribute at the event level of the event log.
pm4py.filtering.filter_trace_attribute_values(); filters the values of an attribute at the trace level of the event log.
pm4py.filtering.filter_variants(); filters the variants of an event log.
pm4py.filtering.filter_directly_follows_relation(); filters the DF-relations of an event log.
pm4py.filtering.filter_eventually_follows_relation(); filters the EF-relations of an event log.
pm4py.filtering.filter_time_range(); filters an event log on a temporal interval.
pm4py.filtering.filter_between(); filters an event log between a given couple of activities.
pm4py.filtering.filter_case_size(); filters an event log based on the size of the cases.
pm4py.filtering.filter_case_performance(); filters an event log based on the throughput time of the cases.
pm4py.filtering.filter_activities_rework(); filters an event log by looking at the cases where a given activity is executed a different number of times.
pm4py.filtering.filter_paths_performance(); filters an event log by examining the performance of the paths between two activities.
pm4py.filtering.filter_variants_top_k(); filters an event log keeping the top-K variants.
pm4py.filtering.filter_variants_by_coverage_percentage(); filters an event log keeping the variants covering the specified percentage of cases.
pm4py.filtering.filter_prefixes(); filters the prefixes of an activity.
pm4py.filtering.filter_suffixes(); filters the suffixes of an activity.
pm4py.filtering.filter_trace_segments(); filters based on the given traces (segments of activities).
pm4py.filtering.filter_four_eyes_principle(); applies the Four-Eyes principle on the event log (LTL).
pm4py.filtering.filter_activity_done_different_resources(); filters the cases where an activity is repeated by different resources (LTL).
Also, some filtering techniques are offered on top of object-centric event logs:
pm4py.filtering.filter_ocel_event_attribute(); filters the events of an object-centric event log having a given value for an attribute.
pm4py.filtering.filter_ocel_object_attribute(); filters the objects of an object-centric event log having a given value for an attribute.
pm4py.filtering.filter_ocel_object_types_allowed_activities(); filters the relations between events (activities) and objects (object types) in an object-centric event log.
pm4py.filtering.filter_ocel_object_per_type_count(); filters the objects of an object-centric event log having at least the specified number of objects per object type.
pm4py.filtering.filter_ocel_start_events_per_object_type(); filters the events of an object-centric event log that start the lifecycle of an object of a given object type.
pm4py.filtering.filter_ocel_end_events_per_object_type(); filters the events of an object-centric event log that end the lifecycle of an object of a given object type.
pm4py.filtering.filter_ocel_events_timestamp(); filters the events of an object-centric event log based on a timestamp range.
pm4py.filtering.filter_ocel_object_types(); filters a specified collection of object types from the object-centric event log.
pm4py.filtering.filter_ocel_events(); filters a specified collection of event identifiers from the object-centric event log.
pm4py.filtering.filter_ocel_objects(); filters a specified collection of object identifiers from the object-centric event log.
pm4py.filtering.filter_ocel_cc_object(); filters a connected component from the object-centric event log to which the object with the provided identifier belongs.
pm4py.filtering.filter_ocel_cc_length(); filters the connected components from an object-centric event log having a number of objects falling within a provided range.
pm4py.filtering.filter_ocel_cc_otype(); filters the connected components from an object-centric event log having at least one object of the specified object type.
pm4py.filtering.filter_ocel_cc_activity(); filters the connected components from an object-centric event log having at least one event with the specified activity.
Machine Learning (pm4py.ml)#
PM4Py offers some features useful for the application of machine learning techniques. Among those:
pm4py.ml.split_train_test(); splits an event log into a training event log (default 80% of the cases) and a test event log (default 20% of the cases).
pm4py.ml.get_prefixes_from_log(); gets fixed-length prefixes for the cases of an event log.
pm4py.ml.extract_features_dataframe(); extracts machine learning features from an event log.
pm4py.ml.extract_ocel_features(); extracts machine learning features from an object-centric event log.
pm4py.ml.extract_temporal_features_dataframe(); extracts temporal features from an event log.
pm4py.ml.extract_target_vector(); extracts from a log object the target vector for a specific ML use case.
pm4py.ml.extract_outcome_enriched_dataframe(); inserts additional columns in the dataframe which are computed on the overall case, so they model the outcome of the case.
Simulation (pm4py.sim)#
We offer different simulation algorithms that, starting from a model, are able to produce an output that follows the model and the different rules provided by the user. Among those:
pm4py.sim.play_out(); performs the play-out of a process model to obtain an event log.
pm4py.sim.generate_process_tree(); generates a process tree with the desired number of nodes.
Object-Centric Process Mining (pm4py.ocel)#
Traditional event logs, used by mainstream process mining techniques, require the events to be related to a case. A case is a set of events for a particular purpose. A case notion is a criterion to assign a case to the events.
However, in real processes, this leads to two problems:
If we consider the Order-to-Cash process, an order could be related to many different deliveries. If we consider the delivery as the case notion, the same event of Create Order needs to be replicated in different cases (all the deliveries involving the order). This is called the convergence problem.
If we consider the Order-to-Cash process, an order could contain different order items, each with a different lifecycle. If we consider the order as the case notion, several instances of the activities for the single items may be contained in the case, and this makes the frequency/performance annotation of the process problematic. This is called the divergence problem.
Object-centric event logs relax the assumption that an event is related to exactly one case. Indeed, an event can be related to different objects of different object types.
Essentially, we can describe the different components of an object-centric event log as:
Events, having an identifier, an activity, a timestamp, a list of related objects, and a dictionary of other attributes.
Objects, having an identifier, a type, and a dictionary of other attributes.
Attribute names, e.g., the possible keys for the attributes of the event/object attribute map.
Object types, e.g., the possible types for the objects.
In PM4Py, we offer object-centric process mining features:
pm4py.ocel.ocel_get_object_types(); gets the object types from an object-centric event log.
pm4py.ocel.ocel_get_attribute_names(); gets the attribute names from an object-centric event log.
pm4py.ocel.ocel_flattening(); flattens an object-centric event log with the selection of an object type.
pm4py.ocel.ocel_object_type_activities(); gets the activities related to an object type in an object-centric event log.
pm4py.ocel.ocel_objects_ot_count(); counts the objects for an object type.
pm4py.ocel.ocel_temporal_summary(); returns the temporal summary from an object-centric event log.
pm4py.ocel.ocel_objects_summary(); returns the objects summary from an object-centric event log.
pm4py.ocel.ocel_objects_interactions_summary(); returns the objects interactions from an object-centric event log.
pm4py.ocel.sample_ocel_objects(); returns a sampled object-centric event log by picking a subset of the objects from the original one.
pm4py.ocel.sample_ocel_connected_components(); returns a sampled object-centric event log containing the provided number of connected components.
pm4py.ocel.ocel_drop_duplicates(); drops relations between events and objects happening at the same time.
pm4py.ocel.ocel_merge_duplicates(); merges events in the OCEL that are happening with the same activity at the same timestamp.
pm4py.ocel.ocel_o2o_enrichment(); enriches the O2O table of the OCEL with the graph-based relationships.
pm4py.ocel.ocel_e2o_lifecycle_enrichment(); enriches the relations table of the OCEL with lifecycle-based information.
pm4py.ocel.cluster_equivalent_ocel(); performs a clustering of the objects of an OCEL based on lifecycle/interactions similarity.
Some object-centric process discovery algorithms are also offered:
pm4py.ocel.discover_ocdfg(); discovers an object-centric directly-follows graph from the object-centric event log.
pm4py.ocel.discover_oc_petri_net(); discovers an object-centric Petri net from the object-centric event log.
pm4py.ocel.discover_objects_graph(); discovers an object-based graph from the object-centric event log.
LLM Integration (pm4py.llm)#
The following methods provide just the abstractions of the given objects:
pm4py.llm.abstract_dfg(); provides the DFG abstraction of a traditional event log
pm4py.llm.abstract_variants(); provides the variants abstraction of a traditional event log
pm4py.llm.abstract_log_attributes(); provides the abstraction of the attributes/columns of the event log
pm4py.llm.abstract_log_features(); provides the abstraction of the machine learning features obtained from an event log
pm4py.llm.abstract_case(); provides the abstraction of a case (collection of events)
pm4py.llm.abstract_ocel(); provides the abstraction of an object-centric event log (list of events and objects)
pm4py.llm.abstract_ocel_ocdfg(); provides the abstraction of an object-centric event log (OC-DFG)
pm4py.llm.abstract_ocel_features(); provides the abstraction of an object-centric event log (features for ML)
pm4py.llm.abstract_event_stream(); provides an abstraction of the (last) events of the stream related to a traditional event log
pm4py.llm.abstract_temporal_profile(); provides the abstraction of a temporal profile model
pm4py.llm.abstract_petri_net(); provides the abstraction of a Petri net
pm4py.llm.abstract_declare(); provides the abstraction of a DECLARE model
pm4py.llm.abstract_log_skeleton(); provides the abstraction of a log skeleton model
pm4py.llm.explain_visualization(); explains one of the visualizations provided in PM4Py using LVMs.
The following methods can be executed directly against the LLM APIs:
pm4py.llm.openai_query(); executes a prompt against OpenAI, returning the response as a string
Basic Connectors (pm4py.connectors)#
We offer some basic connectors to get an event log for some processes:
pm4py.connectors.extract_log_outlook_mails(); extracts a traditional Pandas dataframe representing Outlook mails
pm4py.connectors.extract_log_outlook_calendar(); extracts a traditional Pandas dataframe representing the Outlook calendar
pm4py.connectors.extract_log_windows_events(); extracts a traditional Pandas dataframe containing the Windows events registry
pm4py.connectors.extract_log_chrome_history(); extracts a traditional Pandas dataframe containing the Chrome navigation history
pm4py.connectors.extract_log_firefox_history(); extracts a traditional Pandas dataframe containing the Firefox navigation history
pm4py.connectors.extract_log_github(); extracts a traditional Pandas dataframe of a GitHub repository (issues management)
pm4py.connectors.extract_log_camunda_workflow(); extracts a traditional Pandas dataframe from the database supporting Camunda
pm4py.connectors.extract_log_sap_o2c(); extracts a traditional Pandas dataframe from the database supporting SAP (O2C process)
pm4py.connectors.extract_log_sap_accounting(); extracts a traditional Pandas dataframe from the database supporting SAP (Accounting process)
pm4py.connectors.extract_ocel_outlook_mails(); extracts an object-centric event log representing Outlook mails
pm4py.connectors.extract_ocel_outlook_calendar(); extracts an object-centric event log representing the Outlook calendar
pm4py.connectors.extract_ocel_windows_events(); extracts an object-centric event log representing the Windows events
pm4py.connectors.extract_ocel_chrome_history(); extracts an object-centric event log representing the Chrome history
pm4py.connectors.extract_ocel_firefox_history(); extracts an object-centric event log representing the Firefox history
pm4py.connectors.extract_ocel_github(); extracts an object-centric event log of a GitHub repository (issues management)
pm4py.connectors.extract_ocel_camunda_workflow(); extracts an object-centric event log from the database supporting Camunda
pm4py.connectors.extract_ocel_sap_o2c(); extracts an object-centric event log from the database supporting SAP (O2C process)
pm4py.connectors.extract_ocel_sap_accounting(); extracts an object-centric event log from the database supporting SAP (Accounting process)
Privacy (pm4py.privacy)#
We offer the following algorithms for the anonymization of event logs:
pm4py.privacy.anonymize_differential_privacy(); PRIPEL (Privacy-preserving event log publishing with contextual information) is a framework to publish event logs that fulfill differential privacy.
Utilities (pm4py.utils)#
Other algorithms, which do not belong to the aforementioned categories, are collected in this section:
pm4py.utils.format_dataframe(); ensures the correct formatting of the Pandas dataframe.
pm4py.utils.parse_process_tree(); parses a process tree from a string.
pm4py.utils.parse_powl_model_string(); parses a POWL model from a string.
pm4py.utils.parse_event_log_string(); parses an event log from a collection of comma-separated traces.
pm4py.utils.project_on_event_attribute(); projects an event log on top of a given attribute (e.g., the activity), obtaining a list of lists of values for the attribute.
pm4py.utils.sample_cases(); samples a traditional event log, returning the specified number of cases.
pm4py.utils.sample_events(); samples a traditional event log / OCEL, returning the specified number of events.
pm4py.utils.serialize(); serializes mainstream PM4Py objects as strings.
pm4py.utils.deserialize(); deserializes mainstream PM4Py objects given their string representation.
pm4py.analysis.cluster_log(); clusters a log into sublogs using the provided clusterer.
pm4py.analysis.insert_case_service_waiting_time(); inserts, for each case, the service and waiting time.
pm4py.analysis.insert_case_arrival_finish_rate(); inserts the case arrival/finish rate.
pm4py.analysis.insert_artificial_start_end(); inserts artificial start/end activities in the event log.
pm4py.analysis.compute_emd(); computes the Earth-Mover Distance between two languages.
pm4py.analysis.check_is_workflow_net(); checks if a Petri net is a workflow net.
pm4py.analysis.check_soundness(); checks if a Petri net is a sound workflow net (using Woflan).
pm4py.analysis.solve_marking_equation(); solves the marking equation.
pm4py.analysis.maximal_decomposition(); performs the maximal decomposition of the given Petri net.
pm4py.analysis.generate_marking(); generates a Marking object from a textual representation.
pm4py.analysis.reduce_petri_net_invisibles(); reduces the invisible transitions of a Petri net when possible.
pm4py.analysis.reduce_petri_net_implicit_places(); reduces the implicit places in the Petri net (using MURATA).
pm4py.analysis.get_enabled_transitions(); gets the transitions enabled in a given marking.
pm4py.analysis.simplicity_petri_net(); computes the simplicity metric on the given Petri net.
pm4py.analysis.behavioral_similarity(); computes the behavioral similarity between two process models.
pm4py.analysis.structural_similarity(); computes the structural similarity between two process models.
pm4py.analysis.embeddings_similarity(); computes the embeddings similarity between two process models.
pm4py.analysis.label_sets_similarity(); computes the label-sets-similarity between two process models.
pm4py.analysis.get_activity_labels(); gets the activity labels from the given event log or process model.
pm4py.analysis.replace_activity_labels(); uses a substitution dictionary to replace the names of the activities in the process model.
pm4py.analysis.map_labels_from_second_model(); maps the activity labels of the second process model on top of the first.
List of Methods#
The pm4py.read module contains all functionality related to reading files and objects from disk (or via URIs). |
|
|
Reads a BPMN model from a .bpmn file. |
|
Reads a Directly-Follows Graph (DFG) from a .dfg file. |
|
Reads a Petri net object from a .pnml file. |
|
Reads a process tree object from a .ptml file. |
|
Reads an event log stored in XES format (see xes-standard). |
|
Reads an object-centric event log from a CSV file (see: http://www.ocel-standard.org/). |
|
Reads an object-centric event log from a SQLite database (see: http://www.ocel-standard.org/). |
|
Reads an OCEL 2.0 event log from an XML file. |
|
Reads an OCEL 2.0 event log from a SQLite database. |
|
Reads an OCEL 2.0 event log from a JSON-OCEL2 file. |
The |
|
|
Writes a BPMN model object to disk in the |
|
Writes a directly follows graph (DFG) object to disk in the |
|
Writes a Petri net object to disk in the |
|
Writes a process tree object to disk in the |
|
Writes an event log to disk in the XES format (see xes-standard). |
|
Writes an OCEL object to disk in the |
|
Writes an OCEL object to disk to a |
|
Writes an OCEL2.0 object to disk in the |
|
Writes an OCEL2.0 object to disk to a |
|
Writes an OCEL2.0 object to disk in the |
The |
|
|
Converts a DataFrame or EventStream object to an event log object. |
|
Converts a log object or DataFrame to an event stream. |
|
Converts a log object ( |
Converts an object to a BPMN diagram. |
|
Converts an input model to an (accepting) Petri net. |
|
Converts an input model to a process tree. |
|
Converts an input model to a reachability graph (transition system). |
|
|
Converts an event log to an object-centric event log (OCEL) with one or more object types. |
|
Converts an event log to a NetworkX DiGraph object. |
Converts an OCEL to a NetworkX DiGraph object. |
|
Converts a Petri net to a NetworkX DiGraph. |
|
|
Changes the internal type of a Petri net. |
Converts an input model to a POWL model. |
|
The |
|
|
Discovers a Directly-Follows Graph (DFG) from a log. |
Discovers a Performance Directly-Follows Graph from an event log. |
|
Discovers a Petri net using the Alpha Miner. |
|
Discovers a Petri net using the Inductive Miner algorithm. |
|
Discovers a Petri net using the Heuristics Miner. |
|
Discovers a Petri net using the ILP Miner. |
|
Discovers a Process Tree using the Inductive Miner algorithm. |
|
Discovers a Heuristics Net. |
|
Computes the minimum self-distance for each activity observed in an event log. |
|
Discovers the footprints from the provided event log or process model. |
|
Generates the Eventually-Follows Graph from a log. |
|
Discovers a BPMN model using the Inductive Miner algorithm. |
|
Discovers a Transition System from a log. |
|
|
Discovers a Prefix Tree from the provided log. |
Discovers a Temporal Profile from a log. |
|
|
Discovers a DECLARE model from an event log. |
|
Discovers a Log Skeleton from an event log. |
|
Discovers batches from the provided log. |
|
Discovers a POWL (Partially Ordered Workflow Language) model from an event log. |
The |
|
|
Apply token-based replay for conformance checking analysis. |
Apply the alignments algorithm between a log and a process model. |
|
Provide conformance checking diagnostics using footprints. |
|
Calculate the fitness using token-based replay. |
|
|
Calculate the fitness using alignments. |
Calculate fitness using footprints. |
|
Calculate precision using token-based replay. |
|
|
Calculate the precision of the model with respect to the event log using alignments. |
Calculate precision using footprints. |
|
|
Replay a prefix (list of activities) on a given accepting Petri net using Token-Based Replay. |
Perform conformance checking on the provided log using the provided temporal profile. |
|
|
Apply conformance checking against a DECLARE model. |
Perform conformance checking using the log skeleton. |
|
The pm4py.vis module contains the visualizations offered in pm4py. |
|
|
Views a (composite) Petri net. |
|
Saves a Petri net visualization to a file. |
|
Views a performance DFG. |
|
Saves the visualization of a performance DFG. |
|
Views a (composite) DFG. |
|
Saves a DFG visualization to a file. |
|
Views a process tree. |
|
Saves the visualization of a process tree. |
|
Views a BPMN graph. |
|
Saves the visualization of a BPMN graph. |
|
Views a heuristics net. |
|
Saves the visualization of a heuristics net. |
|
Displays the dotted chart. |
|
Saves the visualization of the dotted chart. |
|
Represents a SNA metric (.html). |
|
Saves the visualization of a SNA metric in a .html file. |
|
Visualizes the case duration graph. |
|
Saves the case duration graph to the specified path. |
|
Visualizes the events per time graph. |
Saves the events per time graph to the specified path. |
|
|
Displays the performance spectrum. |
|
Saves the visualization of the performance spectrum to a file. |
Shows the distribution of the events in the specified dimension. |
|
Saves the distribution of the events in a picture file. |
|
|
Views an OC-DFG (object-centric directly-follows graph). |
|
Saves the visualization of an OC-DFG. |
|
Visualizes the object-centric Petri net. |
|
Saves the visualization of the object-centric Petri net into a file. |
|
Visualizes an object graph on the screen. |
|
Saves the visualization of an object graph. |
|
Visualizes the network analysis. |
|
Saves the visualization of the network analysis. |
|
Views a transition system. |
|
Persists the visualization of a transition system. |
|
Views a prefix tree. |
|
Persists the visualization of a prefix tree. |
|
Views the alignment table as a figure. |
|
Saves an alignment table's figure on disk. |
|
Views the footprints as a figure. |
|
Saves the footprints' visualization on disk. |
|
Performs a visualization of a POWL model. |
|
Saves the visualization of a POWL model. |
The |
|
|
Returns the start activities and their frequencies from a log object. |
|
Returns the end activities and their frequencies from a log object. |
Returns the list of event-level attributes in the log. |
|
Returns the list of trace-level attributes in the log. |
|
|
Returns the values and their frequencies for a specified event attribute. |
|
Returns the values and their frequencies for a specified trace attribute. |
|
Retrieves the variants from the log. |
|
Retrieves the variants from the log, where the variant keys are tuples. |
|
Splits an event log into sub-dataframes for each process variant. |
Associates a pandas DataFrame aggregated by variants and their positions within each variant. |
|
Computes the minimum self-distance for each activity observed in an event log. |
|
Derives the minimum self-distance witnesses for each activity. |
|
|
Calculates the average time difference between the start times of two consecutive cases. |
Identifies activities that have rework occurrences, i.e., activities that occur more than once within the same case. |
|
|
Calculates the cycle time of the event log. |
|
Retrieves the durations of all cases in the event log. |
|
Retrieves the duration of a specific case. |
|
Retrieves frequent trace segments (sub-sequences of activities) from an event log. |
|
Computes the service time for each activity in the event log using the specified aggregation measure. |
Summarizes the positions of a specific activity across all cases in the event log. |
|
|
Retrieves the stochastic language from the provided object. |
The |
|
|
Filters the event log, keeping only the events that have an attribute value which occurs: - in at least the specified (min_relative_stake) percentage of events when level="events", - in at least the specified (min_relative_stake) percentage of cases when level="cases". |
|
Filters cases that have a start activity in the provided list. |
|
Filters cases that have an end activity in the provided list. |
Filters a log object based on the values of a specified event attribute. |
|
Filters a log based on the values of a specified trace attribute. |
|
|
Filters a log based on a specified set of variants. |
Retains traces that contain any of the specified 'directly follows' relations. |
|
Retains traces that contain any of the specified 'eventually follows' relations. |
|
|
Filters a log based on a time interval. |
|
Finds all the sub-cases leading from an event with activity "act1" to an event with activity "act2" in the log, and returns a log containing only them. |
|
Filters the event log, keeping cases that have a length (number of events) between min_size and max_size. |
|
Filters the event log, keeping cases that have a duration (the timestamp of the last event minus the timestamp of the first event) between min_performance and max_performance. |
Filters the event log, keeping cases where the specified activity occurs at least min_occurrences times. |
|
Filters the event log based on the performance of specified paths. |
|
Keeps the top-k variants of the log. |
|
Filters the variants of the log based on a coverage percentage. |
|
|
Filters the log, keeping the prefixes leading up to a given activity. |
|
Filters the log, keeping the suffixes starting from a given activity. |
|
Filters an event log based on a set of trace segments. |
Filters the object-centric event log based on the provided event attribute values. |
|
Filters the object-centric event log based on the provided object attribute values. |
|
|
Filters an object-centric event log, keeping only the specified object types with the specified set of allowed activities. |
Filters the events of the object-centric logs that are related to at least the specified number of objects per type. |
|
|
Filters the events in which a new object of the given object type is spawned. |
Filters the events in which an object of the given object type terminates its lifecycle. |
|
Filters the object-centric event log, keeping events within the provided timestamp range. |
|
Filters out the cases of the log that violate the four-eyes principle on the provided activities. |
|
|
Filters the cases where an activity is performed by different resources multiple times. |
Filters the object types of an object-centric event log. |
|
|
Filters the event identifiers of an object-centric event log. |
|
Filters the object identifiers of an object-centric event log. |
|
Returns the connected component of the object-centric event log to which the specified object belongs. |
|
Keeps only the objects in an OCEL belonging to a connected component with a length falling within the specified range. |
|
Filters the objects belonging to connected components that have at least one object of the specified type. |
Filters the objects belonging to connected components that include at least one event with the specified activity. |
|
The |
|
|
Splits an event log into a training log and a test log for machine learning purposes. |
|
Retrieves prefixes of traces in a log up to a specified length. |
|
Extracts a dataframe containing features for each case in the provided log object. |
Extracts temporal features from a log object and returns them as a dataframe. |
|
|
Extracts the target vector from a log object for a specific machine learning use case. |
Enriches a dataframe with additional outcome-related columns computed from the entire case. |
|
|
Extracts a set of features from an object-centric event log (OCEL) for objects of a specified type. |
The |
|
|
Performs the playout of the provided model, generating a set of traces. |
|
Generates a process tree. |
The |
|
Returns the list of object types contained in the object-centric event log (e.g., ["order", "item", "delivery"]). |
|
Returns the list of attributes at the event and object levels of an object-centric event log (e.g., ["cost", "amount", "name"]). |
|
|
Flattens the object-centric event log to a traditional event log based on a chosen object type. |
Returns the set of activities performed for each object type. |
|
Returns the count of related objects per type for each event. |
|
|
Discovers an Object-Centric Directly-Follows Graph (OC-DFG) from an object-centric event log. |
|
Discovers an object-centric Petri net from the provided object-centric event log. |
Returns the temporal summary of an object-centric event log. |
|
Returns the objects summary of an object-centric event log. |
|
Returns the objects interactions summary of an object-centric event log. |
|
|
Returns a sampled object-centric event log containing a random subset of objects. |
Returns a sampled object-centric event log containing a specified number of connected components. |
|
Removes duplicate relations between events and objects that occur at the same time, have the same activity, and are linked to the same object identifier. |
|
|
Merges events in the OCEL that have the same activity and timestamp. |
|
Enriches the OCEL with information inferred from graph computations by inserting them into the O2O relations. |
Enriches the OCEL with lifecycle-based information, indicating when an object is created, terminated, or has other types of relations, by updating the E2O relations. |
|
|
Clusters the object-centric event log based on the 'executions' of a single object type. |
PM4Py – A Process Mining Library for Python |
|
|
Obtains the DFG (Directly-Follows Graph) abstraction of a traditional event log. |
|
Obtains the variants abstraction of a traditional event log. |
|
Obtains the abstraction of an object-centric event log, including the list of events and the objects of the OCEL. |
|
Obtains the abstraction of an object-centric event log, representing the object-centric directly-follows graph in text. |
|
Obtains the abstraction of an object-centric event log, representing the features and their values in text. |
|
Obtains the event stream abstraction of a traditional event log. |
|
Obtains an abstraction of a Petri net. |
|
Abstracts the attributes of a log by reporting their names, types, and top values. |
|
Abstracts the machine learning features obtained from a log by reporting the top features until the desired length is achieved. |
|
Abstracts a temporal profile model into a descriptive string. |
|
Textually abstracts a single case from an event log. |
|
Textually abstracts a DECLARE model. |
|
Textually abstracts a log skeleton process model. |
|
Executes the provided prompt, obtaining the answer from the OpenAI APIs. |
|
Explains a process mining visualization using LLMs by saving it as a .png image and providing the image to the Large Language Model along with a description. |
Extracts the history of conversations from the local instance of Microsoft Outlook running on the current computer. |
|
Extracts the history of calendar events (creation, update, start, end) into a Pandas DataFrame from the local Outlook instance running on the current computer. |
|
Extracts a process mining DataFrame from all events recorded in the Windows registry. |
|
Extracts a DataFrame containing the navigation history of Google Chrome. |
|
Extracts a DataFrame containing the navigation history of Mozilla Firefox. |
|
|
Extracts a DataFrame containing the history of issues from a GitHub repository. |
Extracts a DataFrame from the Camunda workflow system. |
|
|
Extracts a DataFrame for the SAP Order-to-Cash (O2C) process. |
Extracts a DataFrame for the SAP Accounting process. |
|
Extracts the history of conversations from the local instance of Microsoft Outlook running on the current computer as an object-centric event log. |
|
Extracts the history of calendar events (creation, update, start, end) as an object-centric event log from the local Outlook instance running on the current computer. |
|
Extracts an object-centric event log from all events recorded in the Windows registry. |
|
Extracts an object-centric event log containing the navigation history of Google Chrome. |
|
Extracts an object-centric event log containing the navigation history of Mozilla Firefox. |
|
Extracts an object-centric event log containing the history of issues from a GitHub repository. |
|
Extracts an object-centric event log from the Camunda workflow system. |
|
|
Extracts an object-centric event log for the SAP Order-to-Cash (O2C) process. |
Extracts an object-centric event log for the SAP Accounting process. |
|
The |
|
Calculates the handover of work network of the event log. |
|
Calculates the working together network of the process. |
|
Calculates similarity between the resources in the event log based on their activity profiles. |
|
Calculates the subcontracting network of the process. |
|
Mines the organizational roles. |
|
|
Performs a network analysis of the log based on the provided parameters. |
|
Applies clustering to the provided event log by extracting profiles for the log's traces and clustering them using a Scikit-Learn clusterer (default is K-Means with two clusters). |
Inserts service time, waiting time, and sojourn time information for each case into a Pandas DataFrame. |
|
Inserts arrival and finish rate information for each case into a Pandas DataFrame. |
|
|
Solves the marking equation of a Petri net using an Integer Linear Programming (ILP) approach. |
|
Checks if a given Petri net is a sound Workflow net (WF-net). |
Inserts artificial start and end activities into an event log or a Pandas DataFrame. |
|
Checks if the input Petri net satisfies the WF-net (Workflow net) conditions: 1. |
|
|
Calculates the maximal decomposition of an accepting Petri net into its maximal components. |
|
Generates a marking for a given Petri net based on specified places and token counts. |
|
Computes the Earth Mover Distance (EMD) between two stochastic languages. |
Reduces the number of invisible transitions in the provided Petri net. |
|
Reduces the number of implicit places in the provided Petri net. |
|
|
Retrieves the set of transitions that are enabled in a given marking of a Petri net. |
|
Computes the simplicity metric for a given Petri net model. |
Computes the behavioral similarity (footprints-based) between two process models. |
|
Computes the structural similarity between two semi-block-structured process models, following an approach similar to: |
|
Computes the embeddings similarity between two process models, following the approach described in: |
|
Gets the activity labels from the specified event log / process model. |
|
Replace the activity labels in the specified process model. |
|
Computes the label sets similarity between two process models. |
|
Maps the labels from the second process model into the first. |
|
|
Re-bases the log object by changing the case ID, activity, and timestamp attributes. |
|
Parses a process tree from a string. |
|
Parses a POWL model from a string representation of the process model (with the same format as the __repr__ and __str__ methods of the POWL model). |
|
Formats the dataframe appropriately for process mining purposes. |
|
Serializes a PM4Py object into a bytes string. |
|
Deserializes a bytes string back into a PM4Py object. |
|
Parses a collection of traces expressed as strings (e.g., ["A,B,C,D", "A,C,B,D", "A,D"]) into a log object. |
Projects the event log onto a specified event attribute. |
|
|
Randomly samples a given number of cases from the event log. |
|
Randomly samples a given number of events from the event log. |
Social Network Analysis (
pm4py.org)#We offer different algorithms for the analysis of the organizational networks starting from an event log: