From b3020733fcac7437823bc5daa93c273146b0a8e9 Mon Sep 17 00:00:00 2001 From: Caglar Demir Date: Mon, 10 Aug 2026 14:03:10 +0200 Subject: [PATCH] Prune two Improvements.md duplication items already fixed on develop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #616 (tree_learner_refinement dedup) and PR #615 (quality_funcs dedup) each pruned their own item from Improvements.md's §2 Code duplication, but #616's branch was updated from develop mid-review via a merge commit (2acaa0f) that re-added both bullets instead of keeping them removed — a bad conflict resolution, not a revert of either fix. Both fixes are still present in the code (quality_funcs.py delegates to metrics.py's F1/Accuracy; TDL_refinement.fit()/create_training_data() are deduplicated against TDL via shared hooks). This just corrects the stale doc. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01H4NxQxE3vqNs2DQBWVaFeM --- Improvements.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Improvements.md b/Improvements.md index 68a42284..24ff63cc 100644 --- a/Improvements.md +++ b/Improvements.md @@ -15,22 +15,6 @@ remain open as of this writing. ## 2. Code duplication -- **`ontolearn/quality_funcs.py:31-56`** duplicates the tp/tn/fp/fn and - precision/recall math already implemented in `ontolearn/metrics.py:67-92`'s - `F1`/`Accuracy` classes. Have `quality_funcs.py` delegate to those classes - instead of reimplementing the arithmetic. -- **`ontolearn/learners/tree_learner_refinement_inherit.py` vs - `tree_learner.py`** — `TDL_refinement(TDL)` is ~70% copy-pasted rather than - extended. `fit()` (tree_learner_refinement_inherit.py:604-761) duplicates - `TDL.fit()` (tree_learner.py:661-736) almost line-for-line (grid search, - classifier training, `report_classification`, plotting) with only the - refinement loop spliced in; `extract_expressions_from_owl_individuals`, - `create_training_data`, and `_extract_data_property_features` are likewise - wholesale overrides. A template-method refactor — pulling - `_train_classifier`/`_report`/`_plot` into the base `TDL` as hooks — would - remove on the order of 300 duplicated lines. (`OCEL(CELOE)` in - `ontolearn/learners/celoe.py`/`ocel.py` is a good counter-example of doing - this inheritance correctly — worth using as the template.) - **`ontolearn/knowledge_base.py:191-262`** — `abox()` repeats the same triple-traversal ~70 lines of near-identical branching, once per `mode in {"native", "iri", "axiom"}`, differing only in output formatting.