Repository navigation
Fix #611: cache per-feature DL syntax in TDL_refinement._merge_binary_feature_matrices - #619
Merged
Merged
Conversation
…ure_matrices owl_expression_to_dl recursively walks the expression tree, so re-rendering it for every example was O(examples x features x expression-size) instead of O(features x expression-size). Cache the rendering per feature before the example loop. Fixes #611 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MLhnPY616ht2DRE275DuCE
Demirrr
force-pushed
the
fix-611-tdl-refinement-dl-syntax-caching
branch
from
August 11, 2026 06:33
e5a92c4 to
3a3121c
Compare
Demirrr
marked this pull request as ready for review
August 11, 2026 06:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TDL_refinement._merge_binary_feature_matricesre-rendered each candidate feature's DL syntax string from scratch inside the innermost (per-example) loop, giving O(examples × features × expression-size) work instead of O(features × expression-size).owl_expression_to_dlrecursively walks the expression tree so its cost scales with expression complexity.dl_by_feature = {f: owl_expression_to_dl(f) for f in new_features_list}once before the example loop and look up from that dict inside the loop, as suggested in the issue.[Unreleased] / Changed.Fixes #611
Test plan
ruff check ontolearn/learners/tree_learner_refinement_inherit.py --line-length=200passespytest tests/test_tdl_refinement.py— could not run in this environment due to a pre-existing, unrelatedpandas/bottleneckABI mismatch (AttributeError: _ARRAY_API not found) that reproduces ondevelopas well, before this change. Please run CI to confirm.🤖 Generated with Claude Code
https://claude.ai/code/session_01MLhnPY616ht2DRE275DuCE