mining.inductive: replace the InductiveMining class with a pure function #70

Open
opened 2026-10-09 12:21:59 +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/inductive_mining.py:17-36 — InductiveMining(BaseMining); the constructor sets traces_threshold, filtered_log, use_petri_net, petri_net and two converters on self.
  • app/mining_algorithms/inductive_mining.py:38-122 — generate_graph writes the thresholds and use_petri_net to self, then node_sizes, filtered_log, self.graph and self.petri_net.
  • app/mining_algorithms/inductive_mining.py:124-268 — inductive_mining, base_cases, calculate_cut, fallthrough and get_log_alphabet are methods, though they work on the log argument.
  • app/ui/inductive_miner_ui/inductive_miner_controller.py:52, :69-81 — the controller reads get_traces_threshold() and use_petri_net back from the instance.

Problem

The recursion itself works on the log it gets, but it lives on a stateful class, and generate_graph keeps its input and output on the instance. The controller decides whether to mine again by reading use_petri_net and the traces threshold from the instance. InductiveMiningInfrequent subclasses this class and overrides its methods, so the two miners share state as well (#71).

Fix

Follow the plan in #66 (code#write-simple-functional-code, code#classes-only-where-they-pay-off):

  • mine_inductive(log, params) -> MiningResult, with params holding traces_threshold, use_petri_net and the shared filter thresholds.
  • inductive_mining, base_cases, calculate_cut, fallthrough and get_log_alphabet become module functions of the log, which IMf (#71) can reuse or wrap without inheritance.
  • MiningResult holds the graph (BPMN or Petri net), the Petri net where built, and the effective parameters.
  • Use the pure helpers for the shared steps of BaseMining (#66).
  • Let InductiveMining delegate to mine_inductive until the controller has moved, then remove it.

Check

  • A unit test calls mine_inductive twice with the same log and params, with and without use_petri_net, 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 InductiveMining\b" 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/inductive_mining.py:17-36` — `InductiveMining(BaseMining)`; the constructor sets `traces_threshold`, `filtered_log`, `use_petri_net`, `petri_net` and two converters on `self`. - `app/mining_algorithms/inductive_mining.py:38-122` — `generate_graph` writes the thresholds and `use_petri_net` to `self`, then `node_sizes`, `filtered_log`, `self.graph` and `self.petri_net`. - `app/mining_algorithms/inductive_mining.py:124-268` — `inductive_mining`, `base_cases`, `calculate_cut`, `fallthrough` and `get_log_alphabet` are methods, though they work on the `log` argument. - `app/ui/inductive_miner_ui/inductive_miner_controller.py:52`, `:69-81` — the controller reads `get_traces_threshold()` and `use_petri_net` back from the instance. ## Problem The recursion itself works on the `log` it gets, but it lives on a stateful class, and `generate_graph` keeps its input and output on the instance. The controller decides whether to mine again by reading `use_petri_net` and the traces threshold from the instance. `InductiveMiningInfrequent` subclasses this class and overrides its methods, so the two miners share state as well (#71). ## Fix Follow the plan in #66 (`code#write-simple-functional-code`, `code#classes-only-where-they-pay-off`): - `mine_inductive(log, params) -> MiningResult`, with `params` holding `traces_threshold`, `use_petri_net` and the shared filter thresholds. - `inductive_mining`, `base_cases`, `calculate_cut`, `fallthrough` and `get_log_alphabet` become module functions of the log, which IMf (#71) can reuse or wrap without inheritance. - `MiningResult` holds the graph (BPMN or Petri net), the Petri net where built, and the effective parameters. - Use the pure helpers for the shared steps of `BaseMining` (#66). - Let `InductiveMining` delegate to `mine_inductive` until the controller has moved, then remove it. ## Check - A unit test calls `mine_inductive` twice with the same log and params, with and without `use_petri_net`, 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 InductiveMining\b" 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#70
No description provided.