forked from SWISDATA/processintel
mining.alpha: the self-loop filter checks only the first activity and runs after the maximality step #15
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ffrauenberger/ProcessIntel#15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: critical (whole activities silently disappear from the Alpha model, depending only on trace order)
Where
app/mining_algorithms/alpha_mining.py:66-95,:280-287Problem
(A, B)that contain a self-loop activity should be removed from YL. The helper only tests the first activity ofAand ofB: A pair like(("x","b"), ("c",))with self-loop activitybsurvives. In the classic α-algorithm all members ofAandBmust satisfya # a, so this pair must be removed. The result is wrong places in the Petri net, and activities can vanish from it (see below).generate_set_yldoesyl_set = xl_setand then callsdiscardon it, which mutatesself.xl_setin place. After mining,self.xl_setno longer contains XL. Nothing readsxl_setafterwards today, so this has no visible effect yet.Steps to reproduce
bhas a self-loop and occurs in a multi-activity set of XL, e.g. as("x","b")xl_setafterwards)Expected behavior
All pairs containing a self-loop activity in
AorBare excluded from YL, andxl_setis unchanged after computing YL.Actual behavior
Pairs whose self-loop activity is not the first element survive and produce wrong places.
xl_setis reduced to YL.Corrections from the review
:72-76) runs before the self-loop removal (:81-94). By then the smaller pairs without the self-loop activity are already gone. Example: XL{(a)→(x), (a)→(x,b), (x)→(c), (x,b)→(c), …}with self-loopb. Maximality drops(a)→(x)and(x)→(c). Removing(a)→(x,b)and(x,b)→(c)afterwards leaves nothing forx.nodes_to_drawholds only YL members, start and end activities (:120-125). Soxdisappears from the net. Whether this happens depends only on the order of traces in the log.any(...)check removes the only remaining pairs in every case.Reproduced with the same traces in two orders:
{(a,x,c):5, (a,b,b,c):1, (a,b,b,b,c):1, (a,b,b,b,b,c):1}, and the same with(a,x,c)last. In the second order, YL is empty and the net has onlyaandc.Fix
generate_set_yl, or skip such subsets ingenerate_set_xl(:46-60). The second matches the classic definition (a # afor all members) and also makes the subset enumeration smaller (#37).any(x in self_loop for x in A) or any(x in self_loop for x in B).yl_set = set(xl_set).self_looponce in_calculate_filtered_model_state(:298-309).Check
New
tests/mining_algorithms/alpha_mining_test.py(no Alpha tests exist):{(('a',),('x',)), (('x',),('c',))}in both trace ordersxl_setis unchanged aftergenerate_set_ylxis a transition of the Petri net aftergenerate_graphUse frequencies that survive the default filters, or set the thresholds to 0.
from
issues/BUG-015-alpha-miner-self-loop-filter-checks-only-first-element.md(code analysis of commit6bcc646, 2026-10-03), corrected by the review inverdicts-claude/BUG-015-alpha-miner-self-loop-filter-checks-only-first-element.mdReviewed by Codex (GPT-6) against origin/main
6bcc646eb464.Review: partially correct.
Reproduced the two trace-order outcomes: one order retains pairs containing
(x,b), while the other has empty YL and losesx. The main corrections and filter-before-maximality fix are supported. One statement is too broad: self-loop activities are not always dropped even after that fix.nodes_to_drawexplicitly unions start and end activities (lines 120–123), so a self-loop activity that is also a boundary activity can still be drawn. Drawing it does not make its length-one-loop behavior correct; α+ support or a warning is still needed.Code references: app/mining_algorithms/alpha_mining.py:120, app/mining_algorithms/alpha_mining.py:66.