Skip to content

TDL: opt-in pruned_leaves extraction (not part of the published TDL) - #674

Merged
Demirrr merged 1 commit into
developfrom
feat/tdl-pruned-leaves
Nov 6, 2026
Merged

Demirrr merged 1 commit into
developfrom
feat/tdl-pruned-leaves

Conversation

@Demirrr

@Demirrr Demirrr commented Nov 5, 2026

Copy link
Copy Markdown
Member

What

Adds an opt-in extraction mode TDL(hypothesis_extraction="pruned_leaves", prune_tolerance=0.0). It takes the predicted_leaves expression and derefines it on the training examples (reduced-error pruning: drop a literal or a whole conjunction while the training F1 stays within prune_tolerance of the unpruned F1).

Important: this is not the published TDL

TDL is a peer-reviewed method. This pruning is not from a peer-reviewed work. It is an Ontolearn addition. That is stated in the module docstring (ontolearn/learners/tdl_pruning.py), in the HYPOTHESIS_EXTRACTION_MODES docstring, in the method docstring and in the CHANGELOG. The default (positive_paths) and all existing modes are unchanged.

Evidence (issue #672, rerun after #673)

Nested CV, 20 problems (18 of them one synthetic Family KB), prune_tolerance=0:

  • length 1.2x shorter at the geometric mean (38 to 32 characters)
  • retrieval of the instances 1.6x faster (faster on 20/20 problems)
  • held-out F1 -0.0006 (Holm p=0.35). Non-inferiority was not tested, so "no loss" is not proven.

Tests

  • tests/test_tdl_pruning.py: unit tests of prune_rules (never lowers F1 at tolerance 0, never longer, tolerance measured against the unpruned rules, no positives is a no-op) and Family tests (training F1 unchanged, not longer, default unchanged, unknown mode rejected).
  • tests/test_tdl_hypothesis_extraction.py: now iterates over the three published modes only.
  • tests/test_tdl.py, tests/test_tdl_regression.py pass; ruff check ontolearn/learners is clean.

🤖 Generated with Claude Code

… of the published TDL)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Demirrr
Demirrr merged commit 2145452 into develop Nov 6, 2026
4 checks passed
@Demirrr
Demirrr deleted the feat/tdl-pruned-leaves branch November 6, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant