mining.fuzzy: nodes are assigned to the wrong cluster by substring matching #5

Open
opened 2026-10-06 13:45:06 +00:00 by ffrauenberger · 1 comment
Owner

Severity: critical (similar activity names silently give a wrong fuzzy model)

Where

  • app/mining_algorithms/fuzzy_mining.py:158-162 (get_node_id)
  • app/mining_algorithms/fuzzy_mining.py:640-644 (__get_cluster_where_node)
  • app/mining_algorithms/fuzzy_mining.py:497-501, :530-539, :565-569 (splitting cluster strings)

Problem

Fuzzy miner clusters are stored as strings (member names joined with cluster_seperator = "---"), and membership is tested with Python's in on that string:

def __get_cluster_where_node(self, character, clustered_nodes):
    for cluster in clustered_nodes:
        if character in cluster:        # substring test, not membership
            return cluster

def get_node_id(self, node):
    for key, value in self.cluster_id_mapping.items():
        if node in key:                 # same problem
            return value

If one activity name is a substring of another member's name (Pay / Pay Invoice, Check / Check Credit, A / A1), the node is matched to the wrong cluster:

  • Edges are aggregated into the wrong cluster, so edge correlation, frequency and significance are wrong.
  • build_fuzzy_graph uses get_node_id for start and end edges, so start/end arcs can point to an unrelated cluster.

An activity whose name contains --- is split into fake members when the cluster string is split again; self.filtered_events.index(src) then raises ValueError and mining crashes.

Steps to reproduce

  1. Open the application
  2. Import a log with activities Pay and Pay Invoice (or an activity whose name contains ---)
  3. Select the Fuzzy Miner and adjust the sliders until Pay Invoice is part of a cluster

Expected behavior

Pay is matched only to the cluster it belongs to. Activity names containing --- are handled like any other name.

Actual behavior

Pay is matched to the cluster that contains Pay Invoice, and its edges are drawn to and aggregated into that cluster. Names containing --- crash mining with ValueError.

Fix

Represent clusters as frozenset / tuple of activities, keep a dict[node -> cluster_id] for lookups, and never encode the structure into strings.


from issues/BUG-005-fuzzy-miner-cluster-lookup-uses-substring-match.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** critical (similar activity names silently give a wrong fuzzy model) ## Where - `app/mining_algorithms/fuzzy_mining.py:158-162` (`get_node_id`) - `app/mining_algorithms/fuzzy_mining.py:640-644` (`__get_cluster_where_node`) - `app/mining_algorithms/fuzzy_mining.py:497-501`, `:530-539`, `:565-569` (splitting cluster strings) ## Problem Fuzzy miner clusters are stored as **strings** (member names joined with `cluster_seperator = "---"`), and membership is tested with Python's `in` on that string: ```python def __get_cluster_where_node(self, character, clustered_nodes): for cluster in clustered_nodes: if character in cluster: # substring test, not membership return cluster def get_node_id(self, node): for key, value in self.cluster_id_mapping.items(): if node in key: # same problem return value ``` If one activity name is a substring of another member's name (`Pay` / `Pay Invoice`, `Check` / `Check Credit`, `A` / `A1`), the node is matched to the wrong cluster: - Edges are aggregated into the wrong cluster, so edge correlation, frequency and significance are wrong. - `build_fuzzy_graph` uses `get_node_id` for start and end edges, so start/end arcs can point to an unrelated cluster. An activity whose name contains `---` is split into fake members when the cluster string is split again; `self.filtered_events.index(src)` then raises `ValueError` and mining crashes. ### Steps to reproduce 1. Open the application 2. Import a log with activities `Pay` and `Pay Invoice` (or an activity whose name contains `---`) 3. Select the Fuzzy Miner and adjust the sliders until `Pay Invoice` is part of a cluster ### Expected behavior `Pay` is matched only to the cluster it belongs to. Activity names containing `---` are handled like any other name. ### Actual behavior `Pay` is matched to the cluster that contains `Pay Invoice`, and its edges are drawn to and aggregated into that cluster. Names containing `---` crash mining with `ValueError`. ## Fix Represent clusters as `frozenset` / `tuple` of activities, keep a `dict[node -> cluster_id]` for lookups, and never encode the structure into strings. --- from `issues/BUG-005-fuzzy-miner-cluster-lookup-uses-substring-match.md` (code analysis of commit 6bcc646, 2026-10-03)
Author
Owner

Reviewed by Codex (GPT-6) against origin/main 6bcc646eb464.

Review: partially correct.

The substring lookup and --- representation defects are real, but the Pay/Pay Invoice reproduction needs a qualification. __get_cluster_where_node is called for activities already present in list_of_clustered_nodes (lines 487–523). If Pay remains an ordinary node, its regular graph edges are not automatically aggregated into the Pay Invoice cluster. Its start/end lookup can still be wrong because get_node_id searches every cluster string. To demonstrate wrong aggregated edges, put Pay in a different cluster and arrange for the Pay Invoice cluster to be searched first. An activity containing --- triggers the splitting problem when it is represented as a cluster member.

Code references: app/mining_algorithms/fuzzy_mining.py:158, app/mining_algorithms/fuzzy_mining.py:487, app/mining_algorithms/fuzzy_mining.py:640.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **Review: partially correct.** The substring lookup and `---` representation defects are real, but the `Pay`/`Pay Invoice` reproduction needs a qualification. `__get_cluster_where_node` is called for activities already present in `list_of_clustered_nodes` (lines 487–523). If `Pay` remains an ordinary node, its regular graph edges are not automatically aggregated into the `Pay Invoice` cluster. Its start/end lookup can still be wrong because `get_node_id` searches every cluster string. To demonstrate wrong aggregated edges, put `Pay` in a different cluster and arrange for the `Pay Invoice` cluster to be searched first. An activity containing `---` triggers the splitting problem when it is represented as a cluster member. Code references: [app/mining_algorithms/fuzzy_mining.py:158](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/mining_algorithms/fuzzy_mining.py#L158), [app/mining_algorithms/fuzzy_mining.py:487](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/mining_algorithms/fuzzy_mining.py#L487), [app/mining_algorithms/fuzzy_mining.py:640](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/mining_algorithms/fuzzy_mining.py#L640).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#5
No description provided.