pm4py.algo.querying.llm.abstractions.log_to_dfg_descr module#

PM4Py – A Process Mining Library for Python Copyright (C) 2026 Process Intelligence Solutions GmbH

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.

Website: https://processintelligence.solutions Contact: info@processintelligence.solutions

class pm4py.algo.querying.llm.abstractions.log_to_dfg_descr.Parameters(*values)[source]#

Bases: Enum

INCLUDE_FREQUENCY = 'include_frequency'#
INCLUDE_PERFORMANCE = 'include_performance'#
MAX_LEN = 'max_len'#
RELATIVE_FREQUENCY = 'relative_frequency'#
RESPONSE_HEADER = 'response_header'#
PRIMARY_PERFORMANCE_AGGREGATION = 'primary_performance_aggregation'#
SECONDARY_PERFORMANCE_AGGREGATION = 'secondary_performance_aggregation'#
ACTIVITY_KEY = 'pm4py:param:activity_key'#
TIMESTAMP_KEY = 'pm4py:param:timestamp_key'#
CASE_ID_KEY = 'pm4py:param:case_id_key'#
pm4py.algo.querying.llm.abstractions.log_to_dfg_descr.abstraction_from_frequency_performance_dfg(freq_dfg: Dict[Tuple[str, str], int], perf_dfg: Dict[Tuple[str, str], Dict[str, float]], parameters: Dict[Any, Any] | None = None) → str[source]#

Obtains the abstraction starting from the knowledge of the frequency of the paths, and their performance.

Minimal viable example:

import pm4py from pm4py.algo.querying.llm.abstractions import log_to_dfg_descr

log = pm4py.read_xes(‘tests/input_data/running-example.xes’) freq_dfg, sa, ea = pm4py.discover_dfg(log) perf_dfg, sa, ea = pm4py.discover_performance_dfg(log) print(log_to_dfg_descr.abstraction_from_frequency_performance_dfg(freq_dfg, perf_dfg))

Parameters:
  • freq_dfg – Dictionary associating to each path its frequency

  • perf_dfg – Dictionary associating to each path its performance. A path (‘A’, ‘B’) is associated to a dictionary containing performance metrics, i.e. (‘A’, ‘B’): {‘mean’: 86400, ‘stdev’: 86400} means that: - the average time between the activities A and B is 1 day - also the standard deviation of the times between A and B is 1 day

  • parameters –

    Optional parameters of the algorithm, including:
    • Parameters.RELATIVE_FREQUENCY => (boolean) decides if the frequency DFG should be normalized to a relative

      frequency

    • Parameters.INCLUDE_FREQUENCY => includes the frequency of the arcs in the textual abstraction

    • Parameters.INCLUDE_PERFORMANCE => includes the performance of the arcs in the textual abstraction

    • Parameters.MAX_LEN => desidered length of the textual abstraction

    • Parameters.RESPONSE_HEADER => includes an header in the textual abstraction, which explains the context

    • Parameters.PRIMARY_PERFORMANCE_AGGREGATION => primary performance metric to be used to express the performance of the arcs (e.g., mean). Available options: mean, median, stdev, min, max, sum

    • Parameters.SECONDARY_PERFORMANCE_AGGREGATION => secondary performance metric to be used to express the performance of the arcs (e.g., stdev). Available options: mean, median, stdev, min, max, sum

Returns:

Textual abstraction

Return type:

textual_abstraction

pm4py.algo.querying.llm.abstractions.log_to_dfg_descr.apply(log_obj: EventLog | EventStream | DataFrame, parameters: Dict[Any, Any] | None = None) → str[source]#

Gets the textual abstraction of the directly-follows graph computed on the provided log object.

Minimal viable example:

import pm4py from pm4py.algo.querying.llm.abstractions import log_to_dfg_descr

log = pm4py.read_xes(‘tests/input_data/running-example.xes’) print(log_to_dfg_descr.apply(log))

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

  • parameters –

    Optional Parameters of the algorithm, including:
    • Parameters.ACTIVITY_KEY => the attribute to be used as activity

    • Parameters.TIMESTAMP_KEY => the attribute to be used as timestamp

    • Parameters.CASE_ID_KEY => the attribute to be used as case ID

    • Parameters.RELATIVE_FREQUENCY => (boolean) decides if the frequency DFG should be normalized to a relative

      frequency

    • Parameters.INCLUDE_FREQUENCY => includes the frequency of the arcs in the textual abstraction

    • Parameters.INCLUDE_PERFORMANCE => includes the performance of the arcs in the textual abstraction

    • Parameters.MAX_LEN => desidered length of the textual abstraction

    • Parameters.RESPONSE_HEADER => includes an header in the textual abstraction, which explains the context

    • Parameters.PRIMARY_PERFORMANCE_AGGREGATION => primary performance metric to be used to express the performance of the arcs (e.g., mean). Available options: mean, median, stdev, min, max, sum

    • Parameters.SECONDARY_PERFORMANCE_AGGREGATION => secondary performance metric to be used to express the performance of the arcs (e.g., stdev). Available options: mean, median, stdev, min, max, sum

Returns:

Textual abstraction

Return type:

textual_abstraction