Skip to content

Commit e6a4e20

Browse files
Merge remote-tracking branch 'upstream/hotfixes' into next_2719
2 parents 2d5d8f2 + 8350559 commit e6a4e20

28 files changed

Lines changed: 577 additions & 285 deletions

File tree

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ RUN apt-get -y install gcc g++ flex bison pkg-config automake autoconf cmake
77
RUN apt-get -y install python3-dev python3-pydot python3-tk
88
RUN apt-get -y install libopenblas-dev liblapack-dev libboost-all-dev libncurses5-dev libtool libssl-dev libjemalloc-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-regex-dev libxml2-dev libxslt-dev libfreetype6-dev libsuitesparse-dev libclang-16-dev llvm-16-dev libthrift-dev libfftw3-dev
99
RUN python3 -m pip install --upgrade pip
10-
RUN pip3 install graphviz==0.21 intervaltree==3.1.0 networkx==3.5 packaging==25.0 python-dateutil==2.9.0.post0 pytz==2025.2 setuptools==80.9.0 six==1.17.0 sortedcontainers==2.4.0 tzdata==2025.2 wheel==0.45.1
11-
RUN pip3 install colorama==0.4.6 cycler==0.12.1 pydotplus==2.0.2 pyparsing==3.2.5 tqdm==4.67.1
10+
RUN pip3 install graphviz==0.21 networkx==3.5 packaging==25.0 python-dateutil==2.9.0.post0 pytz==2025.2 setuptools==80.9.0 six==1.17.0 tzdata==2025.2 wheel==0.45.1
11+
RUN pip3 install colorama==0.4.6 cycler==0.12.1 pyparsing==3.2.5 tqdm==4.67.1
1212
RUN pip3 install lxml==6.0.2 numpy==2.3.4 pandas==2.3.3 scipy==1.16.3
1313
RUN pip3 install contourpy==1.3.3 fonttools==4.60.1 kiwisolver==1.4.9 matplotlib==3.10.7 pillow==12.0.0
1414
RUN pip3 install anyio==4.11.0 asttokens==3.0.0 attrs==25.4.0 certifi==2025.10.5 charset-normalizer==3.4.4 convertdate==2.4.0 decorator==5.2.1 distro==1.9.0 executing==2.2.1 h11==0.16.0 httpcore==1.0.9 httpx==0.28.1 idna==3.11 ipython==9.6.0 jedi==0.19.2 Jinja2==3.1.6 jsonpickle==4.1.1 jsonschema-specifications==2025.9.1 lunardate==0.2.2 MarkupSafe==3.0.3 matplotlib-inline==0.2.1 parso==0.8.5 prompt-toolkit==3.0.52 pure-eval==0.2.3 pydantic==2.12.3 Pygments==2.19.2 pyluach==2.3.0 PyMeeus==0.5.12 referencing==0.37.0 rpds-py==0.28.0 sniffio==1.3.1 stack-data==0.6.3 traitlets==5.14.3 typing_extensions==4.15.0 urllib3==2.5.0 wcwidth==0.2.14
15-
RUN pip3 install jsonschema==4.25.1 openai==2.6.1 pyvis==0.3.2 requests==2.32.5 workalendar==17.0.0
15+
RUN pip3 install jsonschema==4.25.1 openai==2.7.1 pyvis==0.3.2 requests==2.32.5 workalendar==17.0.0
1616
RUN pip3 install -U meson-python==0.15.0 Cython==3.0.10 ninja==1.11.1.1 spin==0.8 build==1.2.1 setuptools_scm==8.0.4
1717

1818
#RUN cd / && git clone https://github.com/numpy/numpy.git && cd /numpy && git submodule update --init && pip3 install .

examples/obj_centr_conf_check.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
import pm4py
2-
from pm4py.algo.discovery.ocel.otg import algorithm as otg_discovery
3-
from pm4py.algo.discovery.ocel.etot import algorithm as etot_discovery
4-
from pm4py.algo.conformance.ocel.ocdfg import algorithm as ocdfg_conformance
5-
from pm4py.algo.conformance.ocel.otg import algorithm as otg_conformance
6-
from pm4py.algo.conformance.ocel.etot import algorithm as etot_conformance
72

83

94
def execute_script():
@@ -17,27 +12,23 @@ def execute_script():
1712
# object-centric DFG from OCEL2
1813
ocdfg2 = pm4py.discover_ocdfg(ocel2)
1914
# OTG (object-type-graph) from OCEL2
20-
otg2 = otg_discovery.apply(ocel2)
15+
otg2 = pm4py.discover_otg(ocel2)
2116
# ETOT (ET-OT graph) from OCEL2
22-
etot2 = etot_discovery.apply(ocel2)
17+
etot2 = pm4py.discover_etot(ocel2)
2318

2419
# conformance checking
2520
print("== OCDFG")
26-
diagn_ocdfg = ocdfg_conformance.apply(ocel1, ocdfg2)
21+
diagn_ocdfg = pm4py.conformance_ocdfg(ocel1, ocdfg2)
2722
print(diagn_ocdfg)
2823

2924
print("\n\n== OTG")
30-
diagn_otg = otg_conformance.apply(ocel1, otg2)
25+
diagn_otg = pm4py.conformance_otg(ocel1, otg2)
3126
print(diagn_otg)
3227

3328
print("\n\n== ETOT")
34-
diagn_etot = etot_conformance.apply(ocel1, etot2)
29+
diagn_etot = pm4py.conformance_etot(ocel1, etot2)
3530
print(diagn_etot)
3631

3732

3833
if __name__ == "__main__":
3934
execute_script()
40-
41-
42-
if __name__ == "__main__":
43-
execute_script()

pm4py/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@
156156
discover_declare,
157157
discover_powl,
158158
correlation_miner,
159+
discover_otg,
160+
discover_etot,
159161
)
160162
from pm4py.conformance import (
161163
conformance_diagnostics_token_based_replay,
@@ -171,6 +173,9 @@
171173
conformance_temporal_profile,
172174
conformance_declare,
173175
conformance_log_skeleton,
176+
conformance_ocdfg,
177+
conformance_otg,
178+
conformance_etot,
174179
replay_prefix_tbr,
175180
generalization_tbr,
176181
)

pm4py/algo/filtering/polars/variants/variants_filter.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from pm4py.util.constants import CASE_CONCEPT_NAME, PARAMETER_CONSTANT_CASEID_KEY, PARAMETER_CONSTANT_ACTIVITY_KEY
2323
from enum import Enum
2424
from pm4py.util import exec_utils, constants, xes_constants
25+
from pm4py.statistics.variants.polars import get as variants_get
2526
from typing import Optional, Dict, Any, Union, List
2627
import polars as pl
2728

@@ -92,6 +93,44 @@ def apply(
9293
return ret
9394

9495

96+
def filter_variants_top_k(
97+
log: pl.LazyFrame,
98+
k: int,
99+
parameters: Optional[Dict[Union[str, Parameters], Any]] = None,
100+
) -> pl.LazyFrame:
101+
"""
102+
Keeps the top-k variants of the log
103+
104+
Parameters
105+
-------------
106+
log
107+
Event log LazyFrame
108+
k
109+
Number of variants that should be kept
110+
parameters
111+
Parameters
112+
113+
Returns
114+
-------------
115+
filtered_log
116+
Filtered log
117+
"""
118+
if parameters is None:
119+
parameters = {}
120+
121+
variants = variants_get.get_variants_count(log, parameters=parameters)
122+
variant_count = []
123+
for variant, count in variants.items():
124+
variant_count.append([variant, count])
125+
variant_count = sorted(
126+
variant_count, key=lambda x: (x[1], x[0]), reverse=True
127+
)
128+
variant_count = variant_count[: min(k, len(variant_count))]
129+
variants_to_filter = [x[0] for x in variant_count]
130+
131+
return apply(log, variants_to_filter, parameters=parameters)
132+
133+
95134
def apply_auto_filter(
96135
df: pl.LazyFrame,
97136
parameters: Optional[Dict[Union[str, Parameters], Any]] = None,

pm4py/algo/organizational_mining/resource_profiles/variants/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def __compute_workload(
477477
for x in events
478478
]
479479
events = sorted(events)
480-
from intervaltree import IntervalTree, Interval
480+
from pm4py.util.intervaltree import IntervalTree, Interval
481481

482482
tree = IntervalTree()
483483
ev_map = {}

pm4py/algo/organizational_mining/resource_profiles/variants/pandas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def __compute_workload(
470470
for x in events
471471
]
472472
events = sorted(events)
473-
from intervaltree import IntervalTree, Interval
473+
from pm4py.util.intervaltree import IntervalTree, Interval
474474

475475
tree = IntervalTree()
476476
ev_map = {}

pm4py/algo/simulation/montecarlo/variants/petri_semaph_fifo.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
from pm4py.util import xes_constants, exec_utils, constants
2727
from pm4py.objects.stochastic_petri import utils as stochastic_utils
2828
from pm4py.util.dt_parsing.variants import strpfromiso
29-
from pm4py.objects.petri_net.obj import PetriNet, Marking
3029

31-
from intervaltree import Interval, IntervalTree
30+
from pm4py.util.intervaltree import Interval, IntervalTree
3231
from statistics import median
3332
import datetime
3433
import heapq

pm4py/algo/transformation/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,4 @@
2222
from pm4py.util import constants as pm4_constants
2323

2424
if pm4_constants.ENABLE_INTERNAL_IMPORTS:
25-
from pm4py.algo.transformation import log_to_trie, log_to_features, ocel, log_to_target
26-
27-
import importlib.util
28-
29-
if importlib.util.find_spec("intervaltree"):
30-
from pm4py.algo.transformation import log_to_interval_tree
25+
from pm4py.algo.transformation import log_to_trie, log_to_features, ocel, log_to_target, log_to_interval_tree

pm4py/algo/transformation/log_to_features/variants/trace_based.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def resource_workload(
224224
if parameters is None:
225225
parameters = {}
226226

227-
from intervaltree.intervaltree import IntervalTree, Interval
227+
from pm4py.util.intervaltree import IntervalTree, Interval
228228

229229
start_timestamp_key = exec_utils.get_param_value(
230230
Parameters.START_TIMESTAMP_KEY,
@@ -301,7 +301,7 @@ def work_in_progress(
301301
if parameters is None:
302302
parameters = {}
303303

304-
from intervaltree.intervaltree import IntervalTree, Interval
304+
from pm4py.util.intervaltree import IntervalTree, Interval
305305

306306
start_timestamp_key = exec_utils.get_param_value(
307307
Parameters.START_TIMESTAMP_KEY,

pm4py/algo/transformation/log_to_interval_tree/algorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from enum import Enum
2323
from typing import Optional, Dict, Any
2424

25-
from intervaltree import IntervalTree
25+
from pm4py.util.intervaltree import IntervalTree
2626

2727
from pm4py.algo.transformation.log_to_interval_tree.variants import open_paths
2828
from pm4py.objects.log.obj import EventLog

0 commit comments

Comments
 (0)