Repository navigation
TDL: do not create the tautological feature ∀ r⁻.⊤ for inverse properties - #673
Merged
Merged
Conversation
…ties With the filler ⊤, ∀ r⁻.⊤ holds for every individual, but its column was set only for individuals with a predecessor (a duplicate of ∃ r⁻.⊤ that won ties by sorting first). The training matrix therefore disagreed with the reasoner, and a split on it was read back as ⊤ or ⊥. Adds a regression test that every matrix cell agrees with the reasoner and updates the pinned Family CV values that encoded the bug. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 5, 2026
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.
Problem
With
use_inverse=True,TDLadded the feature∀ r⁻.⊤next to∃ r⁻.⊤for every individual that has a predecessor. With the filler⊤,∀ r⁻.⊤is a tautology (the reasoner returns every individual), but its column was set only for individuals with a predecessor. So:Uncleproblem, all of the form∀ r⁻.⊤(hasChild,hasParent,hasSibling,married), alwaysFalsein the matrix where the reasoner saysTrue;∃ r⁻.⊤and, because columns are sorted by DL string and∀sorts before∃, it won ties against it, so a split on it was read back as⊤or⊥.Found while benchmarking a forest variant of TDL (research write-up in #672, follow-up 9).
Change
∀ r⁻.⊤is no longer created (ontolearn/learners/tree_learner.py). New regression testTestTrainingMatrixSemanticsintests/test_tdl.pyasserts that every cell of the training matrix agrees with the reasoner; it fails ondevelopand passes here.Effect on learned hypotheses (behaviour change)
Hypotheses can change. 5-fold CV, held-out F1 with
positive_paths, 18 Family problems (single CV run):The other 14 problems are unchanged; the mean over the 18 problems goes from 0.9647 to 0.9658. Two problems get worse, so this is a correctness fix, not an accuracy improvement.
tests/test_tdl_hypothesis_extraction.pypins CV values; the Cousin and Uncle full-tree values (and its docstring table) are updated to the new numbers.CHANGELOG.mdhas an entry.Not covered
tests/test_tdl*.py(109 passed, 2 skipped) andtests/test_example_concept_learning_evaluation.py(passed). The full suite was not run.tests/test_triplestore.pyneeds a Fuseki server and was not run.🤖 Generated with Claude Code