Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableFactor Fixes #1928

Merged
merged 4 commits into from
Dec 12, 2024
Merged

TableFactor Fixes #1928

merged 4 commits into from
Dec 12, 2024

Conversation

varunagrawal
Copy link
Collaborator

Found some issues in the TableFactor while debugging an incorrect assignment on conversion from DiscreteConditional to TableFactor. The fixes are listed below.

  1. Fix the equals method so it also checks the keys are the same. Updated a unit test to show this.
  2. Updated printing so the vertical bars are neatly aligned.
  3. Check if the size of the provided table matches the maximum cardinality of the keys. Else we get a weird result with collisions like below:
TableFactor:
 f[ (0,2), (1,3), ]
(0, 0)(1, 0) | 0.166667   | 0  // Repeat
(0, 0)(1, 1) | 0.277778   | 1
(0, 0)(1, 2) | 0.3        | 2  // Repeat
(0, 0)(1, 0) | 0.333333   | 3  // Repeat
(0, 1)(1, 1) | 0.333333   | 4  // Repeat
(0, 1)(1, 2) | 0.333333   | 5
(0, 1)(1, 0) | 0.5        | 6
(0, 1)(1, 1) | 0.388889   | 7  // Repeat
(0, 0)(1, 2) | 0.366667   | 8  // Repeat
number of nnzs: 9

I am also working on improving the conversion from DecisionTreeFactor to TableFactor in a way that should be faster and more memory-efficient than the current scheme. I'll probably push that to the next PR.

@varunagrawal varunagrawal self-assigned this Dec 12, 2024
Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stronger for it!

@varunagrawal varunagrawal merged commit 137a503 into develop Dec 12, 2024
33 checks passed
@varunagrawal varunagrawal deleted the fix-table-factor branch December 12, 2024 04:37
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.

2 participants