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 format:
.xes
files (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:
.bpmn
files; File format specifying process models in the BPMN process modeling formalismpm4py.read.read_bpmn()
.dfg
files; File format specifying directly follows graphs (also referred to as process maps)pm4py.read.read_dfg()
.pnml
files; File format specifying Petri net modelspm4py.read.read_pnml()
.ptml
files; File format specifying Process Tree modelspm4py.read.read_ptml()
Importing object-centric event logs is possible given the following formats:
.csv
specificationpm4py.read.read_ocel_csv()
.jsonocel
specificationpm4py.read.read_ocel_json()
.xmlocel
specificationpm4py.read.read_ocel_xml()
.sqlite
specificationpm4py.read.read_ocel_sqlite()
Importing object-centric event logs (OCEL2.0) is possible given the following formats:
.xmlocel
specificationpm4py.read.read_ocel2_xml()
.sqlite
specificationpm4py.read.read_ocel2_sqlite()
.jsonocel
specificationpm4py.read.read_ocel2_json()
Output (pm4py.write
)#
Similarly to event data importing, pm4py
supports export functionalities to:
.bpmn
files,pm4py.write.write_bpmn()
.dfg
files,pm4py.write.write_dfg()
.pnml
files,pm4py.write.write_pnml()
.ptml
files,pm4py.write.write_ptml()
.xes
files.pm4py.write.write_xes()
Exporting object-centric event logs is possible to the following formats:
.csv
specificationpm4py.write.write_ocel_csv()
.jsonocel
specificationpm4py.write.write_ocel_json()
.xmlocel
specificationpm4py.write.write_ocel_xml()
.sqlite
specificationpm4py.write.write_ocel_sqlite()
Exporting object-centric event logs (OCEL2.0) is possible to the following formats:
.xmlocel
specificationpm4py.write.write_ocel2_xml()
.sqlite
specificationpm4py.write.write_ocel2_sqlite()
.jsonocel
specificationpm4py.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 Petri net
pm4py.convert.convert_to_process_tree()
converts a process model to a process tree
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()
change 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 infomration (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 an 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 an 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 offer also 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 an 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 could 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 on the size of the cases.
pm4py.filtering.filter_case_performance()
; filters an event log 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 different times.
pm4py.filtering.filter_paths_performance()
; filters an event log by looking at 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 on the given traces (segments of activities).
pm4py.filtering.filter_four_eyes_principle()
; apply 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 specific amount 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()
; filter the connected components from an object-centric event log having a number of objects falling in a provided range.
pm4py.filtering.filter_ocel_cc_otype()
; filter the connected components from an object-centric event log having at least an object of the specified object type.
pm4py.filtering.filter_ocel_cc_activity()
; filter the connected components from an object-centric event log having at least an 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 that have been 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 desidered 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 criteria 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 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 one with a different lifecycle. If we consider the order as case notion, several instances of the activities for the single items may be contained in the case, and this make 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 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 picking a subset of the objects of 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()
; merge events in the OCEL which are happening with the same activity at the same timestamp.
pm4py.ocel.ocel_o2o_enrichment()
; enriches the O2O table of the OCEL with the grah-based relationships.
pm4py.ocel.ocel_e2o_lifecycle_enrichment()
; enriches the relations table of the OCEL with lifecycle-based information.
pm4py.ocel.cluster_equivalent_ocel()
; perform 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 provides 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 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 the 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 the 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()
; ensure 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 list of values for the attribute.
pm4py.utils.sample_cases()
; samples a traditional event log returning the specified amount of cases.
pm4py.utils.sample_events()
; samples a traditional event log / OCEL returning the specified amount of events.
pm4py.utils.serialize()
; serializes mainstream pm4py objects as strings.
pm4py.utils.deserialize()
; de-serializes mainstream pm4py objects given their string representation.
pm4py.analysis.cluster_log()
; cluster 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()
; check if a Petri net is a workflow net.
pm4py.analysis.check_soundness()
; checks if a Petri net is a sound workflow net (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 (MURATA).
pm4py.analysis.get_enabled_transitions()
; gets the transitions enabled in a given marking.
Overall List of Methods#
The |
|
|
Reads a BPMN model from a .bpmn file |
|
Reads a DFG object 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) Returns a table ( |
|
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 OCEL2.0 event log from an XML file |
|
Reads an OCEL2.0 event log from a SQLite database |
|
Reads an OCEL2.0 event log from a JSON-OCEL(2) 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 to an |
|
Writes an OCEL2.0 object to disk to a |
|
Writes an OCEL2.0 object to disk to an |
The |
|
|
Converts a DataFrame/EventStream object to an event log object |
|
Converts a log object to an event stream |
|
Converts a log object to a dataframe |
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 with one or more than one object types. |
|
Converts an event log object to a NetworkX DiGraph object. |
Converts an OCEL to a NetworkX DiGraph object. |
|
Converts a Petri net to a NetworkX DiGraph. |
|
|
Changes the Petri net (internal) type |
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. |
|
Discover 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 an heuristics net |
|
This algorithm computes the minimum self-distance for each activity observed in an event log. |
|
Discovers the footprints out of the provided event log / process model |
|
Gets the eventually follows graph from a log object. |
|
Discovers a BPMN using the Inductive Miner algorithm |
|
Discovers a transition system as described in the process mining book "Process Mining: Data Science in Action" |
|
|
Discovers a prefix tree from the provided log object. |
Discovers a temporal profile from a log object. |
|
|
Discovers a DECLARE model from an event log. |
|
Discovers a log skeleton from an event log. |
|
Discover batches from the provided log object |
|
Discovers a POWL 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 |
|
Calculates the fitness using token-based replay. |
|
|
Calculates the fitness using alignments The output dictionary contains the following keys: - average_trace_fitness (between 0.0 and 1.0; computed as average of the trace fitnesses) - log_fitness (between 0.0 and 1.0) - percentage_of_fitting_traces (the percentage of fit traces (from 0.0 to 100.0) |
Calculates fitness using footprints. |
|
Calculates the precision precision using token-based replay |
|
|
Calculates the precision of the model w.r.t. |
Calculates precision using footprints |
|
|
Replays a prefix (list of activities) on a given accepting Petri net, using Token-Based Replay. |
Performs conformance checking on the provided log with the provided temporal profile. |
|
|
Applies conformance checking against a DECLARE model. |
Performs conformance checking using the log skeleton |
|
The |
|
|
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 an heuristics net |
|
Saves the visualization of an 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 in the specified path |
|
Visualizes the events per time graph |
Saves the events per time graph in 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) with the provided configuration. |
|
Saves the visualization of an OC-DFG (object-centric directly-follows graph) with the provided configuration. |
|
Visualizes on the screen 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 in the disk |
|
Views the footprints as a figure |
|
Saves the footprints' visualization on disk |
|
Perform a visualization of a POWL model. |
|
Saves the visualization of a POWL model. |
The |
|
|
Returns the start activities from a log object |
|
Returns the end activities of a log |
Returns the attributes at the event level of the log |
|
Gets the attributes at the trace level of a log object |
|
|
Returns the values for a specified (event) attribute |
|
Returns the values for a specified trace attribute |
|
Gets the variants from the log |
|
Gets the variants from the log (where the keys are tuples and not strings) |
|
Splits an event log into sub-dataframes for each process variant. |
Method that associates to a log object a Pandas dataframe aggregated by variants and positions (inside the variant). Each row is associated to different columns: - The variant - The position (in the variant) - The source activity (of the path) - The target activity (of the path) - An aggregation of the times between the two activities (for example, the mean over all the cases of the same variant) - The cumulative occurrences of the path inside the case (for example, the first A->B would be associated to 0, and the second A->B would be associated to 1). |
|
This algorithm computes the minimum self-distance for each activity observed in an event log. |
|
This function derives the minimum self distance witnesses. |
|
|
Gets the average difference between the start times of two consecutive cases |
Find out for which activities of the log the rework (more than one occurrence in the trace for the activity) occurs. |
|
|
Calculates the cycle time of the event log. |
|
Gets the durations of the cases in the event log |
|
Gets the duration of a specific case |
|
Get the traces (segments of activities) from an event log object. |
|
Gets the activities' (average/median/...) service time in the provided event log |
Given an event log, returns a dictionary which summarize the positions of the activities in the different cases of the event log. |
|
|
Gets the stochastic language from the provided object |
The |
|
|
Filters the event log keeping only the events having 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" |
|
Filter cases having a start activity in the provided list |
|
Filter cases having an end activity in the provided list |
Filter a log object on the values of some event attribute |
|
Filter a log on the values of a trace attribute |
|
|
Filter a log on a specified set of variants |
Retain traces that contain any of the specified 'directly follows' relations. |
|
Retain traces that contain any of the specified 'eventually follows' relations. |
|
|
Filter a log 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 the cases having a length (number of events) included between min_size and max_size |
|
Filters the event log, keeping the cases having a duration (the timestamp of the last event minus the timestamp of the first event) included between min_performance and max_performance |
Filters the event log, keeping the cases where the specified activity occurs at least min_occurrences times. |
|
Filters the event log, either: - (keep=True) keeping the cases having the specified path (tuple of 2 activities) with a duration included between min_performance and max_performance - (keep=False) discarding the cases having the specified path with a duration included between min_performance and max_performance |
|
Keeps the top-k variants of the log |
|
Filters the variants of the log by a coverage percentage (e.g., if min_coverage_percentage=0.4, and we have a log with 1000 cases, of which 500 of the variant 1, 400 of the variant 2, and 100 of the variant 3, the filter keeps only the traces of variant 1 and variant 2). |
|
|
Filters the log, keeping the prefixes to a given activity. |
|
Filters the log, keeping the suffixes from a given activity. |
|
Filters an event log on a set of traces. |
Filters the object-centric event log on the provided event attributes values |
|
Filters the object-centric event log on the provided object attributes values |
|
|
Filters an object-centric event log keeping only the specified object types with the specified activity set (filters out the rest). |
Filters the events of the object-centric logs which are related to at least the specified amount of objects per type. |
|
|
Filters the events in which a new object for the given object type is spawn. |
Filters the events in which an object for the given object type terminates its lifecycle. |
|
Filters the object-centric event log keeping events in the provided timestamp range |
|
Filter the cases of the log which violates the four eyes principle on the provided activities. |
|
|
Filters the cases where an activity is repeated by different resources. |
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 object with the provided identifier belongs. |
|
Keeps only the objects in an OCEL belonging to a connected component with a length falling in a specified range |
|
Filters the objects belonging to the connected components having at least an object of the provided object type. |
Filters the objects belonging to the connected components having at least an event with the provided activity. |
|
The |
|
|
Split an event log in a training log and a test log (for machine learning purposes). |
|
Gets the prefixes of a log of a given length. |
|
Extracts a dataframe containing the features of each case of the provided log object |
Extracts a dataframe containing the temporal features of the provided log object |
|
|
Extracts from a log object the target vector for a specific ML use case (next activity, next time, remaining time) |
Inserts additional columns in the dataframe which are computed on the overall case, so they model the outcome of the case. |
|
|
Extracts from an object-centric event log a set of features (returned as dataframe) computed on the OCEL for the objects of a given object type. |
The |
|
|
Performs the playout of the provided model, i.e., gets a set of traces from the model. |
|
Generates a process tree |
The |
|
Gets the list of object types contained in the object-centric event log (e.g., ["order", "item", "delivery"]). |
|
Gets the list of attributes at the event and the object level of an object-centric event log (e.g. ["cost", "amount", "name"]). |
|
|
Flattens the object-centric event log to a traditional event log with the choice of an object type. |
Gets the set of activities performed for each object type |
|
Counts for each event the number of related objects per type |
|
|
Discovers an 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'' from an object-centric event log. The temporal summary aggregates all the events performed in the same timestamp, and reports the list of activities and the involved objects. |
|
Gets the objects summary of an object-centric event log |
|
Gets the objects interactions summary of an object-centric event log. |
|
|
Given an object-centric event log, returns a sampled event log with a subset of the objects that is chosen in a random way. |
Given an object-centric event log, returns a sampled event log with a subset of the executions. |
|
Drop relations between events and objects happening at the same time, with the same activity, to the same object identifier. |
|
|
Merge events in the OCEL that happen with the same activity at the same timestamp |
|
Inserts the information inferred from the graph computations (pm4py.discover_objects_graph) in the list of O2O relations of the OCEL. |
Inserts lifecycle-based information (when an object is created/terminated or other types of relations) in the list of E2O relations of the OCEL |
|
|
Perform a clustering of the object-centric event log, based on the 'executions' of a single object type. |
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de). |
|
|
Obtains the DFG 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 in text the object-centric directly-follows graph |
|
Obtains the abstraction of an object-centric event log, representing in text the features and their values. |
|
Obtains the event stream abstraction of a traditional event log |
|
Obtain an abstraction of a Petri net |
|
Abstracts the attributes of a log (reporting their name, their type, and the top values) |
|
Abstracts the machine learning features obtained from a log (reporting the top features until the desired length is obtained) |
|
Abstracts a temporal profile model to a string. |
|
Textually abstracts a case |
|
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 by using LLMs (saving that first in a .png image, then providing the .png file to the Large Language Model along with possibly a description of the visualization). |
Extracts the history of the conversations from the local instance of Microsoft Outlook running on the current computer. |
|
Extracts the history of the calendar events (creation, update, start, end) in a Pandas dataframe from the local Outlook instance running on the current computer. |
|
Extract a process mining dataframe from all the 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 the issues of a Github repository. |
Extracts a dataframe from the Camunda workflow system. |
|
|
Extracts a dataframe for the SAP O2C process. |
Extracts a dataframe for the SAP Accounting process. |
|
Extracts the history of the conversations from the local instance of Microsoft Outlook running on the current computer as an object-centric event log. |
|
Extracts the history of the calendar events (creation, update, start, end) as an object-centric event log from the local Outlook instance running on the current computer. |
|
Extract a process mining dataframe from all the events recorded in the Windows registry as an object-centric event log. |
|
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 a dataframe containing the history of the issues of a Github repository. |
|
Extracts an object-centric event log from the Camunda workflow system. |
|
|
Extracts an object-centric event log for the SAP 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. |
|
Apply clustering to the provided event log (method based on the extraction of profiles for the traces of the event log) based on a Scikit-Learn clusterer (default: K-means with two clusters) |
Inserts the service/waiting/sojourn times of the case in the dataframe. |
|
Inserts the arrival/finish rates of the case in the dataframe. |
|
|
Solves the marking equation of a Petri net. |
|
Check if a given Petri net is a sound WF-net. A Petri net is a WF-net iff: - it has a unique source place - it has a unique end place - every element in the WF-net is on a path from the source to the sink place A WF-net is sound iff: - it contains no live-locks - it contains no deadlocks - we are able to always reach the final marking For a formal definition of sound WF-net, consider: http://www.padsweb.rwth-aachen.de/wvdaalst/publications/p628.pdf In the returned object, the first element is a boolean indicating if the Petri net is a sound workflow net. The second element is a set of diagnostics collected while running WOFLAN (expressed as a dictionary associating the keys [name of the diagnostics] with the corresponding diagnostics). |
Inserts the artificial start/end activities in an event log / Pandas dataframe |
|
Checks if the input Petri net satisfies the WF-net conditions: 1. |
|
|
Calculate the maximal decomposition of an accepting Petri net. |
|
Generate a marking for a given Petri net |
|
Computes the earth mover distance between two stochastic languages (for example, the first extracted from the log, and the second extracted from the process model. |
Reduce the number of invisibles transitions in the provided Petri net. |
|
Reduce the number of invisibles transitions in the provided Petri net. |
|
|
Gets the transitions enabled in a given marking |
|
Re-base the log object, changing the case ID, activity and timestamp attributes. |
|
Parse a process tree from a string |
|
Parse 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) |
|
Give the appropriate format on the dataframe, for process mining purposes |
|
Serialize a PM4Py object into a bytes string |
|
Deserialize a bytes string to a PM4Py object |
|
Parse a collection of traces expressed as strings (e.g., ["A,B,C,D", "A,C,B,D", "A,D"]) to a log object (Pandas dataframe) |
Project the event log on a specified event attribute. |
|
|
(Random) Sample a given number of cases from the event log. |
|
(Random) Sample 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: