Skip to content

Commit bf76a7c

Browse files
author
Felix Mannhardt
committed
update to most recent pmpy version
1 parent 10a7bed commit bf76a7c

File tree

4 files changed

+102
-252
lines changed

4 files changed

+102
-252
lines changed

python/0_data_loading.ipynb

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,48 @@
146146
"pm4py.get_end_activities(sepsis_log)"
147147
]
148148
},
149+
{
150+
"cell_type": "markdown",
151+
"metadata": {},
152+
"source": [
153+
"In newer PM4Py version the default format of an event log is a Pandas DataFrame (sepsis_log) but we can also look at a log as a list of lists containing all attributes as dictionary (sepsis_event_log)."
154+
]
155+
},
156+
{
157+
"cell_type": "code",
158+
"execution_count": null,
159+
"metadata": {},
160+
"outputs": [],
161+
"source": [
162+
"sepsis_log"
163+
]
164+
},
165+
{
166+
"cell_type": "code",
167+
"execution_count": null,
168+
"metadata": {},
169+
"outputs": [],
170+
"source": [
171+
"from pm4py.objects.conversion.log import converter as log_conversion\n",
172+
"sepsis_event_log = log_conversion.apply(sepsis_log, {}, log_conversion.TO_EVENT_LOG)"
173+
]
174+
},
175+
{
176+
"cell_type": "code",
177+
"execution_count": null,
178+
"metadata": {},
179+
"outputs": [],
180+
"source": [
181+
"sepsis_event_log"
182+
]
183+
},
184+
{
185+
"cell_type": "markdown",
186+
"metadata": {},
187+
"source": [
188+
"A typical 'view' on the log is to project events on the event label (concept:name in XES):"
189+
]
190+
},
149191
{
150192
"cell_type": "code",
151193
"execution_count": null,
@@ -154,7 +196,7 @@
154196
"source": [
155197
"from pm4py.objects.log.util.log import project_traces\n",
156198
"def print_nth(log, index):\n",
157-
" print(str(project_traces(sepsis_log)[index]))"
199+
" print(str(project_traces(log, 'concept:name')[index]))"
158200
]
159201
},
160202
{
@@ -163,7 +205,7 @@
163205
"metadata": {},
164206
"outputs": [],
165207
"source": [
166-
"print_nth(sepsis_log, 0)"
208+
"print_nth(sepsis_event_log, 0)"
167209
]
168210
},
169211
{
@@ -172,7 +214,7 @@
172214
"metadata": {},
173215
"outputs": [],
174216
"source": [
175-
"print_nth(sepsis_log, 1)"
217+
"print_nth(sepsis_event_log, 1)"
176218
]
177219
},
178220
{
@@ -228,7 +270,7 @@
228270
"source": [
229271
"A bit more comprehensible but more filtering or pre-processing could be performed, explore the PM4Py documentation on what is possible:\n",
230272
"\n",
231-
"https://pm4py.fit.fraunhofer.de/documentation#filtering\n",
273+
"https://processintelligence.solutions/static/api/2.7.11/api.html#filtering-pm4py-filtering\n",
232274
"\n",
233275
"You can also look at the trace or event attributes in an event log to generate suitable subsets."
234276
]
@@ -275,7 +317,7 @@
275317
"name": "python",
276318
"nbconvert_exporter": "python",
277319
"pygments_lexer": "ipython3",
278-
"version": "3.8.13"
320+
"version": "3.10.12"
279321
},
280322
"vscode": {
281323
"interpreter": {

python/1_data_preparation.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@
5353
"# download from 4tu.nl\n",
5454
"urlretrieve('https://data.4tu.nl/file/33632f3c-5c48-40cf-8d8f-2db57f5a6ce7/643dccf2-985a-459e-835c-a82bce1c0339', 'sepsis1.xes.gz')\n",
5555
"sepsis_log = pm4py.read_xes('sepsis1.xes.gz')\n",
56-
"os.unlink('sepsis1.xes.gz') # clean up"
56+
"os.unlink('sepsis1.xes.gz') # clean up\n",
57+
"\n",
58+
"# Here we want the multiset (or rather list) of sequences view on logs\n",
59+
"from pm4py.objects.conversion.log import converter as log_conversion\n",
60+
"sepsis_log = log_conversion.apply(sepsis_log, {}, log_conversion.TO_EVENT_LOG)"
5761
]
5862
},
5963
{
@@ -468,7 +472,7 @@
468472
"name": "python",
469473
"nbconvert_exporter": "python",
470474
"pygments_lexer": "ipython3",
471-
"version": "3.8.13"
475+
"version": "3.10.12"
472476
},
473477
"vscode": {
474478
"interpreter": {

python/2_prediction_outcome.ipynb

Lines changed: 48 additions & 243 deletions
Large diffs are not rendered by default.

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# we use the old PM4Py API that was considerably changed in 2.3.0
2-
pm4py @ git+https://github.com/fmannhardt/pm4py-source@2.2.31-legacy
1+
pm4py==2.7.12.3
32
numpy
43
pandas
54
networkx

0 commit comments

Comments
 (0)