mining.fuzzy: replace the FuzzyMining class with a pure function #69

Open
opened 2026-10-09 12:21:57 +00:00 by ffrauenberger · 0 comments
Owner

Severity: improvement (part of #66; the miner's result depends on the history of its instance)
Requested by: the user (2026-10-09)

Where

  • app/mining_algorithms/fuzzy_mining.py:8-34 — FuzzyMining(BaseMining); the constructor sets about 15 fields (clustered_nodes, sign_dict, removed_edges, the five fuzzy parameters, …).
  • app/mining_algorithms/fuzzy_mining.py:36-156 — generate_graph writes all parameters to self, then intermediate results (corr_after_first_rule, sign_after_first_rule, removed_edges, list_of_clustered_nodes, sign_dict, cluster_id_mapping) and finally self.graph.
  • app/mining_algorithms/fuzzy_mining.py:909-922 — getters for the five fuzzy parameters.
  • app/mining_algorithms/fuzzy_mining.py:944-953 — _calculate_filtered_model_state stores correlation_of_nodes, significance_of_nodes and node_significance_matrix on self.
  • app/converters/dfg_converter.py:120-150 — build_fuzzy_graph(miner, data) sets miner.graph and calls private miner methods through name mangling (#50).
  • app/ui/fuzzy_miner_ui/fuzzy_miner_controller.py:56-90, :116-135, :148-149 — the controller reads the getters and edge_absolute_counts from the instance.

Problem

The fuzzy miner is the largest stateful miner. Its steps pass intermediate results to each other through self, and the converter reaches back into the instance to draw the graph. A step's result depends on which fields an earlier step or an earlier run left behind.

Fix

Follow the plan in #66 (code#write-simple-functional-code):

  • mine_fuzzy(log, params) -> MiningResult, with params holding the unary and binary significance, correlation, edge cutoff, utility ratio and the shared filter thresholds.
  • Each step (first rule, edge filtering, clustering, significance after clustering) becomes a function that takes the previous step's values and returns new ones.
  • The converter takes plain data (clusters, significances, edges, start and end nodes) instead of the miner. This also fixes #50.
  • MiningResult holds the graph and the effective parameters the controller now reads through getters.
  • Use the pure helpers for the shared steps of BaseMining (#66).
  • Let FuzzyMining delegate to mine_fuzzy until the controller has moved, then remove it.

Related: #40 (cubic loops in the fuzzy miner) is easier once the steps are separate functions.

Check

  • A unit test calls mine_fuzzy twice with the same log and params and gets equal results.
  • A test runs it with other params first, then with the first params again, and gets the same result as on a fresh call.
  • git grep -n "class FuzzyMining\|_FuzzyMining__" app returns nothing.

from a session on 2026-10-09, split from #66

**Severity:** improvement (part of #66; the miner's result depends on the history of its instance) **Requested by:** the user (2026-10-09) ## Where - `app/mining_algorithms/fuzzy_mining.py:8-34` — `FuzzyMining(BaseMining)`; the constructor sets about 15 fields (`clustered_nodes`, `sign_dict`, `removed_edges`, the five fuzzy parameters, …). - `app/mining_algorithms/fuzzy_mining.py:36-156` — `generate_graph` writes all parameters to `self`, then intermediate results (`corr_after_first_rule`, `sign_after_first_rule`, `removed_edges`, `list_of_clustered_nodes`, `sign_dict`, `cluster_id_mapping`) and finally `self.graph`. - `app/mining_algorithms/fuzzy_mining.py:909-922` — getters for the five fuzzy parameters. - `app/mining_algorithms/fuzzy_mining.py:944-953` — `_calculate_filtered_model_state` stores `correlation_of_nodes`, `significance_of_nodes` and `node_significance_matrix` on `self`. - `app/converters/dfg_converter.py:120-150` — `build_fuzzy_graph(miner, data)` sets `miner.graph` and calls private miner methods through name mangling (#50). - `app/ui/fuzzy_miner_ui/fuzzy_miner_controller.py:56-90`, `:116-135`, `:148-149` — the controller reads the getters and `edge_absolute_counts` from the instance. ## Problem The fuzzy miner is the largest stateful miner. Its steps pass intermediate results to each other through `self`, and the converter reaches back into the instance to draw the graph. A step's result depends on which fields an earlier step or an earlier run left behind. ## Fix Follow the plan in #66 (`code#write-simple-functional-code`): - `mine_fuzzy(log, params) -> MiningResult`, with `params` holding the unary and binary significance, correlation, edge cutoff, utility ratio and the shared filter thresholds. - Each step (first rule, edge filtering, clustering, significance after clustering) becomes a function that takes the previous step's values and returns new ones. - The converter takes plain data (clusters, significances, edges, start and end nodes) instead of the miner. This also fixes #50. - `MiningResult` holds the graph and the effective parameters the controller now reads through getters. - Use the pure helpers for the shared steps of `BaseMining` (#66). - Let `FuzzyMining` delegate to `mine_fuzzy` until the controller has moved, then remove it. Related: #40 (cubic loops in the fuzzy miner) is easier once the steps are separate functions. ## Check - A unit test calls `mine_fuzzy` twice with the same log and params and gets equal results. - A test runs it with other params first, then with the first params again, and gets the same result as on a fresh call. - `git grep -n "class FuzzyMining\|_FuzzyMining__" app` returns nothing. --- from a session on 2026-10-09, split from #66
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#69
No description provided.