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:

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:

Importing object-centric event logs is possible given the following formats:

Importing object-centric event logs (OCEL2.0) is possible given the following formats:

Output (pm4py.write)#

Similarly to event data importing, pm4py supports export functionalities to:

Exporting object-centric event logs is possible to the following formats:

Exporting object-centric event logs (OCEL2.0) is possible to the following formats:

Conversion (pm4py.convert)#

Several conversions are available from/to different objects supported by pm4py. The following conversions are currently available:

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:

Among procedural process models, pm4py currently supports:

Among declarative process models, pm4py currently supports:

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:

Among declarative process models, pm4py currently supports:

Visualization (pm4py.vis)#

The pm4py library implements basic visualizations of process models and statistics. Among the on-screen visualizations, pm4py currently supports:

We also offer some methods to store the visualizations on the disk:

Statistics (pm4py.stats)#

Different statistics that can be computed on top of event logs are proposed, including:

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:

Also, some filtering techniques are offered on top of object-centric event logs:

Machine Learning (pm4py.ml)#

PM4Py offers some features useful for the application of machine learning techniques. Among those:

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:

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:

Some object-centric process discovery algorithms are also offered:

LLM Integration (pm4py.llm)#

The following methods provide just the abstractions of the given objects:

The following methods can be executed directly against the LLM APIs:

Basic Connectors (pm4py.connectors)#

We offer some basic connectors to get an event log for some processes:

Social Network Analysis (pm4py.org)#

We offer different algorithms for the analysis of the organizational networks starting from an event log:

Privacy (pm4py.privacy)#

We offer the following algorithms for the anonymization of event logs:

Utilities (pm4py.utils)#

Other algorithms, which do not belong to the aforementioned categories, are collected in this section:

List of Methods#

pm4py.read

The pm4py.read module contains all functionality related to reading files and objects from disk (or via URIs).

pm4py.read.read_bpmn(file_path[, encoding])

Reads a BPMN model from a .bpmn file.

pm4py.read.read_dfg(file_path[, encoding])

Reads a Directly-Follows Graph (DFG) from a .dfg file.

pm4py.read.read_pnml(file_path[, ...])

Reads a Petri net object from a .pnml file.

pm4py.read.read_ptml(file_path[, encoding])

Reads a process tree object from a .ptml file.

pm4py.read.read_xes(file_path[, variant, ...])

Reads an event log stored in XES format (see xes-standard).

pm4py.read.read_ocel_csv(file_path[, ...])

Reads an object-centric event log from a CSV file (see: http://www.ocel-standard.org/).

pm4py.read.read_ocel_sqlite(file_path[, ...])

Reads an object-centric event log from a SQLite database (see: http://www.ocel-standard.org/).

pm4py.read.read_ocel2_xml(file_path[, encoding])

Reads an OCEL 2.0 event log from an XML file.

pm4py.read.read_ocel2_sqlite(file_path[, ...])

Reads an OCEL 2.0 event log from a SQLite database.

pm4py.read.read_ocel2_json(file_path[, encoding])

Reads an OCEL 2.0 event log from a JSON-OCEL2 file.

pm4py.write

The pm4py.write module contains all functionality related to writing files/objects to disk.

pm4py.write.write_bpmn(model, file_path[, ...])

Writes a BPMN model object to disk in the .bpmn format.

pm4py.write.write_dfg(dfg, start_activities, ...)

Writes a directly follows graph (DFG) object to disk in the .dfg format.

pm4py.write.write_pnml(petri_net, ...[, ...])

Writes a Petri net object to disk in the .pnml format (see pnml-standard).

pm4py.write.write_ptml(tree, file_path[, ...])

Writes a process tree object to disk in the .ptml format.

pm4py.write.write_xes(log, file_path[, ...])

Writes an event log to disk in the XES format (see xes-standard).

pm4py.write.write_ocel_csv(ocel, file_path, ...)

Writes an OCEL object to disk in the .csv file format.

pm4py.write.write_ocel_sqlite(ocel, file_path)

Writes an OCEL object to disk to a SQLite database (exported as .sqlite file).

pm4py.write.write_ocel2_xml(ocel, file_path)

Writes an OCEL2.0 object to disk in the .xmlocel file format.

pm4py.write.write_ocel2_sqlite(ocel, file_path)

Writes an OCEL2.0 object to disk to a SQLite database (exported as .sqlite file).

pm4py.write.write_ocel2_json(ocel, file_path)

Writes an OCEL2.0 object to disk in the .jsonocel file format.

pm4py.convert

The pm4py.convert module contains the cross-conversions implemented in pm4py

pm4py.convert.convert_to_event_log(obj[, ...])

Converts a DataFrame or EventStream object to an event log object.

pm4py.convert.convert_to_event_stream(obj[, ...])

Converts a log object or DataFrame to an event stream.

pm4py.convert.convert_to_dataframe(obj, **kwargs)

Converts a log object (EventStream or EventLog) to a Pandas DataFrame.

pm4py.convert.convert_to_bpmn(*args)

Converts an object to a BPMN diagram.

pm4py.convert.convert_to_petri_net(*args)

Converts an input model to an (accepting) Petri net.

pm4py.convert.convert_to_process_tree(*args)

Converts an input model to a process tree.

pm4py.convert.convert_to_reachability_graph(*args)

Converts an input model to a reachability graph (transition system).

pm4py.convert.convert_log_to_ocel(log[, ...])

Converts an event log to an object-centric event log (OCEL) with one or more object types.

pm4py.convert.convert_log_to_networkx(log[, ...])

Converts an event log to a NetworkX DiGraph object.

pm4py.convert.convert_ocel_to_networkx(ocel)

Converts an OCEL to a NetworkX DiGraph object.

pm4py.convert.convert_petri_net_to_networkx(...)

Converts a Petri net to a NetworkX DiGraph.

pm4py.convert.convert_petri_net_type(net, im, fm)

Changes the internal type of a Petri net.

pm4py.convert.convert_to_powl(*args)

Converts an input model to a POWL model.

pm4py.discovery

The pm4py.discovery module contains the process discovery algorithms implemented in pm4py.

pm4py.discovery.discover_dfg(log[, ...])

Discovers a Directly-Follows Graph (DFG) from a log.

pm4py.discovery.discover_performance_dfg(log)

Discovers a Performance Directly-Follows Graph from an event log.

pm4py.discovery.discover_petri_net_alpha(log)

Discovers a Petri net using the Alpha Miner.

pm4py.discovery.discover_petri_net_inductive(log)

Discovers a Petri net using the Inductive Miner algorithm.

pm4py.discovery.discover_petri_net_heuristics(log)

Discovers a Petri net using the Heuristics Miner.

pm4py.discovery.discover_petri_net_ilp(log)

Discovers a Petri net using the ILP Miner.

pm4py.discovery.discover_process_tree_inductive(log)

Discovers a Process Tree using the Inductive Miner algorithm.

pm4py.discovery.discover_heuristics_net(log)

Discovers a Heuristics Net.

pm4py.discovery.derive_minimum_self_distance(log)

Computes the minimum self-distance for each activity observed in an event log.

pm4py.discovery.discover_footprints(*args)

Discovers the footprints from the provided event log or process model.

pm4py.discovery.discover_eventually_follows_graph(log)

Generates the Eventually-Follows Graph from a log.

pm4py.discovery.discover_bpmn_inductive(log)

Discovers a BPMN model using the Inductive Miner algorithm.

pm4py.discovery.discover_transition_system(log)

Discovers a Transition System from a log.

pm4py.discovery.discover_prefix_tree(log[, ...])

Discovers a Prefix Tree from the provided log.

pm4py.discovery.discover_temporal_profile(log)

Discovers a Temporal Profile from a log.

pm4py.discovery.discover_declare(log[, ...])

Discovers a DECLARE model from an event log.

pm4py.discovery.discover_log_skeleton(log[, ...])

Discovers a Log Skeleton from an event log.

pm4py.discovery.discover_batches(log[, ...])

Discovers batches from the provided log.

pm4py.discovery.discover_powl(log[, ...])

Discovers a POWL (Partially Ordered Workflow Language) model from an event log.

pm4py.conformance

The pm4py.conformance module contains the conformance checking algorithms implemented in pm4py.

pm4py.conformance.conformance_diagnostics_token_based_replay(...)

Apply token-based replay for conformance checking analysis.

pm4py.conformance.conformance_diagnostics_alignments(...)

Apply the alignments algorithm between a log and a process model.

pm4py.conformance.conformance_diagnostics_footprints(*args)

Provide conformance checking diagnostics using footprints.

pm4py.conformance.fitness_token_based_replay(...)

Calculate the fitness using token-based replay.

pm4py.conformance.fitness_alignments(log, ...)

Calculate the fitness using alignments.

pm4py.conformance.fitness_footprints(*args)

Calculate fitness using footprints.

pm4py.conformance.precision_token_based_replay(...)

Calculate precision using token-based replay.

pm4py.conformance.precision_alignments(log, ...)

Calculate the precision of the model with respect to the event log using alignments.

pm4py.conformance.precision_footprints(*args)

Calculate precision using footprints.

pm4py.conformance.replay_prefix_tbr(prefix, ...)

Replay a prefix (list of activities) on a given accepting Petri net using Token-Based Replay.

pm4py.conformance.conformance_temporal_profile(...)

Perform conformance checking on the provided log using the provided temporal profile.

pm4py.conformance.conformance_declare(log, ...)

Apply conformance checking against a DECLARE model.

pm4py.conformance.conformance_log_skeleton(...)

Perform conformance checking using the log skeleton.

pm4py.vis

The pm4py.vis module contains the visualizations offered in pm4py.

pm4py.vis.view_petri_net(petri_net[, ...])

Views a (composite) Petri net.

pm4py.vis.save_vis_petri_net(petri_net, ...)

Saves a Petri net visualization to a file.

pm4py.vis.view_performance_dfg(dfg, ...[, ...])

Views a performance DFG.

pm4py.vis.save_vis_performance_dfg(dfg, ...)

Saves the visualization of a performance DFG.

pm4py.vis.view_dfg(dfg, start_activities, ...)

Views a (composite) DFG.

pm4py.vis.save_vis_dfg(dfg, ...[, bgcolor, ...])

Saves a DFG visualization to a file.

pm4py.vis.view_process_tree(tree[, format, ...])

Views a process tree.

pm4py.vis.save_vis_process_tree(tree, file_path)

Saves the visualization of a process tree.

pm4py.vis.view_bpmn(bpmn_graph[, format, ...])

Views a BPMN graph.

pm4py.vis.save_vis_bpmn(bpmn_graph, file_path)

Saves the visualization of a BPMN graph.

pm4py.vis.view_heuristics_net(heu_net[, ...])

Views a heuristics net.

pm4py.vis.save_vis_heuristics_net(heu_net, ...)

Saves the visualization of a heuristics net.

pm4py.vis.view_dotted_chart(log[, format, ...])

Displays the dotted chart.

pm4py.vis.save_vis_dotted_chart(log, file_path)

Saves the visualization of the dotted chart.

pm4py.vis.view_sna(sna_metric[, variant_str])

Represents a SNA metric (.html).

pm4py.vis.save_vis_sna(sna_metric, file_path)

Saves the visualization of a SNA metric in a .html file.

pm4py.vis.view_case_duration_graph(log[, ...])

Visualizes the case duration graph.

pm4py.vis.save_vis_case_duration_graph(log, ...)

Saves the case duration graph to the specified path.

pm4py.vis.view_events_per_time_graph(log[, ...])

Visualizes the events per time graph.

pm4py.vis.save_vis_events_per_time_graph(...)

Saves the events per time graph to the specified path.

pm4py.vis.view_performance_spectrum(log, ...)

Displays the performance spectrum.

pm4py.vis.save_vis_performance_spectrum(log, ...)

Saves the visualization of the performance spectrum to a file.

pm4py.vis.view_events_distribution_graph(log)

Shows the distribution of the events in the specified dimension.

pm4py.vis.save_vis_events_distribution_graph(...)

Saves the distribution of the events in a picture file.

pm4py.vis.view_ocdfg(ocdfg[, annotation, ...])

Views an OC-DFG (object-centric directly-follows graph).

pm4py.vis.save_vis_ocdfg(ocdfg, file_path[, ...])

Saves the visualization of an OC-DFG.

pm4py.vis.view_ocpn(ocpn[, format, bgcolor, ...])

Visualizes the object-centric Petri net.

pm4py.vis.save_vis_ocpn(ocpn, file_path[, ...])

Saves the visualization of the object-centric Petri net into a file.

pm4py.vis.view_object_graph(ocel, graph[, ...])

Visualizes an object graph on the screen.

pm4py.vis.save_vis_object_graph(ocel, graph, ...)

Saves the visualization of an object graph.

pm4py.vis.view_network_analysis(network_analysis)

Visualizes the network analysis.

pm4py.vis.save_vis_network_analysis(...[, ...])

Saves the visualization of the network analysis.

pm4py.vis.view_transition_system(...[, ...])

Views a transition system.

pm4py.vis.save_vis_transition_system(...[, ...])

Persists the visualization of a transition system.

pm4py.vis.view_prefix_tree(trie[, format, ...])

Views a prefix tree.

pm4py.vis.save_vis_prefix_tree(trie, file_path)

Persists the visualization of a prefix tree.

pm4py.vis.view_alignments(log, aligned_traces)

Views the alignment table as a figure.

pm4py.vis.save_vis_alignments(log, ...[, ...])

Saves an alignment table's figure on disk.

pm4py.vis.view_footprints(footprints[, ...])

Views the footprints as a figure.

pm4py.vis.save_vis_footprints(footprints, ...)

Saves the footprints' visualization on disk.

pm4py.vis.view_powl(powl[, format, bgcolor, ...])

Performs a visualization of a POWL model.

pm4py.vis.save_vis_powl(powl, file_path[, ...])

Saves the visualization of a POWL model.

pm4py.stats

The pm4py.stats module contains the statistical functionalities offered in pm4py.

pm4py.stats.get_start_activities(log[, ...])

Returns the start activities and their frequencies from a log object.

pm4py.stats.get_end_activities(log[, ...])

Returns the end activities and their frequencies from a log object.

pm4py.stats.get_event_attributes(log)

Returns the list of event-level attributes in the log.

pm4py.stats.get_trace_attributes(log)

Returns the list of trace-level attributes in the log.

pm4py.stats.get_event_attribute_values(log, ...)

Returns the values and their frequencies for a specified event attribute.

pm4py.stats.get_trace_attribute_values(log, ...)

Returns the values and their frequencies for a specified trace attribute.

pm4py.stats.get_variants(log[, ...])

Retrieves the variants from the log.

pm4py.stats.get_variants_as_tuples(log[, ...])

Retrieves the variants from the log, where the variant keys are tuples.

pm4py.stats.split_by_process_variant(log[, ...])

Splits an event log into sub-dataframes for each process variant.

pm4py.stats.get_variants_paths_duration(log)

Associates a pandas DataFrame aggregated by variants and their positions within each variant.

pm4py.stats.get_minimum_self_distances(log)

Computes the minimum self-distance for each activity observed in an event log.

pm4py.stats.get_minimum_self_distance_witnesses(log)

Derives the minimum self-distance witnesses for each activity.

pm4py.stats.get_case_arrival_average(log[, ...])

Calculates the average time difference between the start times of two consecutive cases.

pm4py.stats.get_rework_cases_per_activity(log)

Identifies activities that have rework occurrences, i.e., activities that occur more than once within the same case.

pm4py.stats.get_cycle_time(log[, ...])

Calculates the cycle time of the event log.

pm4py.stats.get_all_case_durations(log[, ...])

Retrieves the durations of all cases in the event log.

pm4py.stats.get_case_duration(log, case_id)

Retrieves the duration of a specific case.

pm4py.stats.get_frequent_trace_segments(log, ...)

Retrieves frequent trace segments (sub-sequences of activities) from an event log.

pm4py.stats.get_service_time(log[, ...])

Computes the service time for each activity in the event log using the specified aggregation measure.

pm4py.stats.get_activity_position_summary(...)

Summarizes the positions of a specific activity across all cases in the event log.

pm4py.stats.get_stochastic_language(*args, ...)

Retrieves the stochastic language from the provided object.

pm4py.filtering

The pm4py.filtering module contains the filtering features offered in pm4py.

pm4py.filtering.filter_log_relative_occurrence_event_attribute(...)

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".

pm4py.filtering.filter_start_activities(log, ...)

Filters cases that have a start activity in the provided list.

pm4py.filtering.filter_end_activities(log, ...)

Filters cases that have an end activity in the provided list.

pm4py.filtering.filter_event_attribute_values(...)

Filters a log object based on the values of a specified event attribute.

pm4py.filtering.filter_trace_attribute_values(...)

Filters a log based on the values of a specified trace attribute.

pm4py.filtering.filter_variants(log, variants)

Filters a log based on a specified set of variants.

pm4py.filtering.filter_directly_follows_relation(...)

Retains traces that contain any of the specified 'directly follows' relations.

pm4py.filtering.filter_eventually_follows_relation(...)

Retains traces that contain any of the specified 'eventually follows' relations.

pm4py.filtering.filter_time_range(log, dt1, dt2)

Filters a log based on a time interval.

pm4py.filtering.filter_between(log, act1, act2)

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.

pm4py.filtering.filter_case_size(log, ...[, ...])

Filters the event log, keeping cases that have a length (number of events) between min_size and max_size.

pm4py.filtering.filter_case_performance(log, ...)

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.

pm4py.filtering.filter_activities_rework(...)

Filters the event log, keeping cases where the specified activity occurs at least min_occurrences times.

pm4py.filtering.filter_paths_performance(...)

Filters the event log based on the performance of specified paths.

pm4py.filtering.filter_variants_top_k(log, k)

Keeps the top-k variants of the log.

pm4py.filtering.filter_variants_by_coverage_percentage(...)

Filters the variants of the log based on a coverage percentage.

pm4py.filtering.filter_prefixes(log, activity)

Filters the log, keeping the prefixes leading up to a given activity.

pm4py.filtering.filter_suffixes(log, activity)

Filters the log, keeping the suffixes starting from a given activity.

pm4py.filtering.filter_trace_segments(log, ...)

Filters an event log based on a set of trace segments.

pm4py.filtering.filter_ocel_event_attribute(...)

Filters the object-centric event log based on the provided event attribute values.

pm4py.filtering.filter_ocel_object_attribute(...)

Filters the object-centric event log based on the provided object attribute values.

pm4py.filtering.filter_ocel_object_types_allowed_activities(...)

Filters an object-centric event log, keeping only the specified object types with the specified set of allowed activities.

pm4py.filtering.filter_ocel_object_per_type_count(...)

Filters the events of the object-centric logs that are related to at least the specified number of objects per type.

pm4py.filtering.filter_ocel_start_events_per_object_type(...)

Filters the events in which a new object of the given object type is spawned.

pm4py.filtering.filter_ocel_end_events_per_object_type(...)

Filters the events in which an object of the given object type terminates its lifecycle.

pm4py.filtering.filter_ocel_events_timestamp(...)

Filters the object-centric event log, keeping events within the provided timestamp range.

pm4py.filtering.filter_four_eyes_principle(...)

Filters out the cases of the log that violate the four-eyes principle on the provided activities.

pm4py.filtering.filter_activity_done_different_resources(...)

Filters the cases where an activity is performed by different resources multiple times.

pm4py.filtering.filter_ocel_object_types(...)

Filters the object types of an object-centric event log.

pm4py.filtering.filter_ocel_events(ocel, ...)

Filters the event identifiers of an object-centric event log.

pm4py.filtering.filter_ocel_objects(ocel, ...)

Filters the object identifiers of an object-centric event log.

pm4py.filtering.filter_ocel_cc_object(ocel, ...)

Returns the connected component of the object-centric event log to which the specified object belongs.

pm4py.filtering.filter_ocel_cc_length(ocel, ...)

Keeps only the objects in an OCEL belonging to a connected component with a length falling within the specified range.

pm4py.filtering.filter_ocel_cc_otype(ocel, otype)

Filters the objects belonging to connected components that have at least one object of the specified type.

pm4py.filtering.filter_ocel_cc_activity(...)

Filters the objects belonging to connected components that include at least one event with the specified activity.

pm4py.ml

The pm4py.ml module contains the machine learning features offered in pm4py.

pm4py.ml.split_train_test(log[, ...])

Splits an event log into a training log and a test log for machine learning purposes.

pm4py.ml.get_prefixes_from_log(log, length)

Retrieves prefixes of traces in a log up to a specified length.

pm4py.ml.extract_features_dataframe(log[, ...])

Extracts a dataframe containing features for each case in the provided log object.

pm4py.ml.extract_temporal_features_dataframe(log)

Extracts temporal features from a log object and returns them as a dataframe.

pm4py.ml.extract_target_vector(log, variant)

Extracts the target vector from a log object for a specific machine learning use case.

pm4py.ml.extract_outcome_enriched_dataframe(log)

Enriches a dataframe with additional outcome-related columns computed from the entire case.

pm4py.ml.extract_ocel_features(ocel, obj_type)

Extracts a set of features from an object-centric event log (OCEL) for objects of a specified type.

pm4py.sim

The pm4py.sim module contains simulation algorithms provided by pm4py.

pm4py.sim.play_out(*args, **kwargs)

Performs the playout of the provided model, generating a set of traces.

pm4py.sim.generate_process_tree(**kwargs)

Generates a process tree.

pm4py.ocel

The pm4py.ocel module contains the object-centric process mining features offered in pm4py.

pm4py.ocel.ocel_get_object_types(ocel)

Returns the list of object types contained in the object-centric event log (e.g., ["order", "item", "delivery"]).

pm4py.ocel.ocel_get_attribute_names(ocel)

Returns the list of attributes at the event and object levels of an object-centric event log (e.g., ["cost", "amount", "name"]).

pm4py.ocel.ocel_flattening(ocel, object_type)

Flattens the object-centric event log to a traditional event log based on a chosen object type.

pm4py.ocel.ocel_object_type_activities(ocel)

Returns the set of activities performed for each object type.

pm4py.ocel.ocel_objects_ot_count(ocel)

Returns the count of related objects per type for each event.

pm4py.ocel.discover_ocdfg(ocel[, ...])

Discovers an Object-Centric Directly-Follows Graph (OC-DFG) from an object-centric event log.

pm4py.ocel.discover_oc_petri_net(ocel[, ...])

Discovers an object-centric Petri net from the provided object-centric event log.

pm4py.ocel.ocel_temporal_summary(ocel)

Returns the temporal summary of an object-centric event log.

pm4py.ocel.ocel_objects_summary(ocel)

Returns the objects summary of an object-centric event log.

pm4py.ocel.ocel_objects_interactions_summary(ocel)

Returns the objects interactions summary of an object-centric event log.

pm4py.ocel.sample_ocel_objects(ocel, num_objects)

Returns a sampled object-centric event log containing a random subset of objects.

pm4py.ocel.sample_ocel_connected_components(ocel)

Returns a sampled object-centric event log containing a specified number of connected components.

pm4py.ocel.ocel_drop_duplicates(ocel)

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.

pm4py.ocel.ocel_merge_duplicates(ocel[, ...])

Merges events in the OCEL that have the same activity and timestamp.

pm4py.ocel.ocel_o2o_enrichment(ocel[, ...])

Enriches the OCEL with information inferred from graph computations by inserting them into the O2O relations.

pm4py.ocel.ocel_e2o_lifecycle_enrichment(ocel)

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.

pm4py.ocel.cluster_equivalent_ocel(ocel, ...)

Clusters the object-centric event log based on the 'executions' of a single object type.

pm4py.llm

PM4Py – A Process Mining Library for Python

pm4py.llm.abstract_dfg(log_obj[, max_len, ...])

Obtains the DFG (Directly-Follows Graph) abstraction of a traditional event log.

pm4py.llm.abstract_variants(log_obj[, ...])

Obtains the variants abstraction of a traditional event log.

pm4py.llm.abstract_ocel(ocel[, ...])

Obtains the abstraction of an object-centric event log, including the list of events and the objects of the OCEL.

pm4py.llm.abstract_ocel_ocdfg(ocel[, ...])

Obtains the abstraction of an object-centric event log, representing the object-centric directly-follows graph in text.

pm4py.llm.abstract_ocel_features(ocel, obj_type)

Obtains the abstraction of an object-centric event log, representing the features and their values in text.

pm4py.llm.abstract_event_stream(log_obj[, ...])

Obtains the event stream abstraction of a traditional event log.

pm4py.llm.abstract_petri_net(net, im, fm[, ...])

Obtains an abstraction of a Petri net.

pm4py.llm.abstract_log_attributes(log_obj[, ...])

Abstracts the attributes of a log by reporting their names, types, and top values.

pm4py.llm.abstract_log_features(log_obj[, ...])

Abstracts the machine learning features obtained from a log by reporting the top features until the desired length is achieved.

pm4py.llm.abstract_temporal_profile(...[, ...])

Abstracts a temporal profile model into a descriptive string.

pm4py.llm.abstract_case(case[, ...])

Textually abstracts a single case from an event log.

pm4py.llm.abstract_declare(declare_model[, ...])

Textually abstracts a DECLARE model.

pm4py.llm.abstract_log_skeleton(log_skeleton)

Textually abstracts a log skeleton process model.

pm4py.llm.openai_query(prompt[, api_key, ...])

Executes the provided prompt, obtaining the answer from the OpenAI APIs.

pm4py.llm.explain_visualization(vis_saver, *args)

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.

pm4py.connectors.extract_log_outlook_mails()

Extracts the history of conversations from the local instance of Microsoft Outlook running on the current computer.

pm4py.connectors.extract_log_outlook_calendar([...])

Extracts the history of calendar events (creation, update, start, end) into a Pandas DataFrame from the local Outlook instance running on the current computer.

pm4py.connectors.extract_log_windows_events()

Extracts a process mining DataFrame from all events recorded in the Windows registry.

pm4py.connectors.extract_log_chrome_history([...])

Extracts a DataFrame containing the navigation history of Google Chrome.

pm4py.connectors.extract_log_firefox_history([...])

Extracts a DataFrame containing the navigation history of Mozilla Firefox.

pm4py.connectors.extract_log_github([owner, ...])

Extracts a DataFrame containing the history of issues from a GitHub repository.

pm4py.connectors.extract_log_camunda_workflow(...)

Extracts a DataFrame from the Camunda workflow system.

pm4py.connectors.extract_log_sap_o2c(...[, ...])

Extracts a DataFrame for the SAP Order-to-Cash (O2C) process.

pm4py.connectors.extract_log_sap_accounting(...)

Extracts a DataFrame for the SAP Accounting process.

pm4py.connectors.extract_ocel_outlook_mails()

Extracts the history of conversations from the local instance of Microsoft Outlook running on the current computer as an object-centric event log.

pm4py.connectors.extract_ocel_outlook_calendar([...])

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.

pm4py.connectors.extract_ocel_windows_events()

Extracts an object-centric event log from all events recorded in the Windows registry.

pm4py.connectors.extract_ocel_chrome_history([...])

Extracts an object-centric event log containing the navigation history of Google Chrome.

pm4py.connectors.extract_ocel_firefox_history([...])

Extracts an object-centric event log containing the navigation history of Mozilla Firefox.

pm4py.connectors.extract_ocel_github([...])

Extracts an object-centric event log containing the history of issues from a GitHub repository.

pm4py.connectors.extract_ocel_camunda_workflow(...)

Extracts an object-centric event log from the Camunda workflow system.

pm4py.connectors.extract_ocel_sap_o2c(...[, ...])

Extracts an object-centric event log for the SAP Order-to-Cash (O2C) process.

pm4py.connectors.extract_ocel_sap_accounting(...)

Extracts an object-centric event log for the SAP Accounting process.

pm4py.org

The pm4py.org module contains organizational analysis techniques offered in pm4py.

pm4py.org.discover_handover_of_work_network(log)

Calculates the handover of work network of the event log.

pm4py.org.discover_working_together_network(log)

Calculates the working together network of the process.

pm4py.org.discover_activity_based_resource_similarity(log)

Calculates similarity between the resources in the event log based on their activity profiles.

pm4py.org.discover_subcontracting_network(log)

Calculates the subcontracting network of the process.

pm4py.org.discover_organizational_roles(log)

Mines the organizational roles.

pm4py.org.discover_network_analysis(log, ...)

Performs a network analysis of the log based on the provided parameters.

pm4py.analysis

pm4py.analysis.cluster_log(log[, ...])

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).

pm4py.analysis.insert_case_service_waiting_time(log)

Inserts service time, waiting time, and sojourn time information for each case into a Pandas DataFrame.

pm4py.analysis.insert_case_arrival_finish_rate(log)

Inserts arrival and finish rate information for each case into a Pandas DataFrame.

pm4py.analysis.solve_marking_equation(...[, ...])

Solves the marking equation of a Petri net using an Integer Linear Programming (ILP) approach.

pm4py.analysis.check_soundness(petri_net, ...)

Checks if a given Petri net is a sound Workflow net (WF-net).

pm4py.analysis.insert_artificial_start_end(log)

Inserts artificial start and end activities into an event log or a Pandas DataFrame.

pm4py.analysis.check_is_workflow_net(net)

Checks if the input Petri net satisfies the WF-net (Workflow net) conditions: 1.

pm4py.analysis.maximal_decomposition(net, im, fm)

Calculates the maximal decomposition of an accepting Petri net into its maximal components.

pm4py.analysis.generate_marking(net, ...)

Generates a marking for a given Petri net based on specified places and token counts.

pm4py.analysis.compute_emd(language1, language2)

Computes the Earth Mover Distance (EMD) between two stochastic languages.

pm4py.analysis.reduce_petri_net_invisibles(net)

Reduces the number of invisible transitions in the provided Petri net.

pm4py.analysis.reduce_petri_net_implicit_places(...)

Reduces the number of implicit places in the provided Petri net.

pm4py.analysis.get_enabled_transitions(net, ...)

Retrieves the set of transitions that are enabled in a given marking of a Petri net.

pm4py.analysis.simplicity_petri_net(net, im, fm)

Computes the simplicity metric for a given Petri net model.

pm4py.analysis.behavioral_similarity(*args)

Computes the behavioral similarity (footprints-based) between two process models.

pm4py.analysis.structural_similarity(*args)

Computes the structural similarity between two semi-block-structured process models, following an approach similar to:

pm4py.analysis.embeddings_similarity(*args)

Computes the embeddings similarity between two process models, following the approach described in:

pm4py.analysis.get_activity_labels(*args)

Gets the activity labels from the specified event log / process model.

pm4py.analysis.replace_activity_labels(...)

Replace the activity labels in the specified process model.

pm4py.analysis.label_sets_similarity(*args)

Computes the label sets similarity between two process models.

pm4py.analysis.map_labels_from_second_model(*args)

Maps the labels from the second process model into the first.

pm4py.utils

pm4py.utils.rebase(log_obj[, case_id, ...])

Re-bases the log object by changing the case ID, activity, and timestamp attributes.

pm4py.utils.parse_process_tree(tree_string)

Parses a process tree from a string.

pm4py.utils.parse_powl_model_string(powl_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).

pm4py.utils.format_dataframe(df[, case_id, ...])

Formats the dataframe appropriately for process mining purposes.

pm4py.utils.serialize(*args)

Serializes a PM4Py object into a bytes string.

pm4py.utils.deserialize(ser_obj)

Deserializes a bytes string back into a PM4Py object.

pm4py.utils.parse_event_log_string(traces[, ...])

Parses a collection of traces expressed as strings (e.g., ["A,B,C,D", "A,C,B,D", "A,D"]) into a log object.

pm4py.utils.project_on_event_attribute(log)

Projects the event log onto a specified event attribute.

pm4py.utils.sample_cases(log, num_cases[, ...])

Randomly samples a given number of cases from the event log.

pm4py.utils.sample_events(log, num_events)

Randomly samples a given number of events from the event log.