-
Notifications
You must be signed in to change notification settings - Fork 855
Added TableFactor, a discrete factor optimized for sparsity. #1528
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
gtsam/discrete/TableFactor.h
Outdated
using Binary = std::function<double(const double, const double)>; | ||
|
||
public: | ||
/** The Real ring with addition and multiplication */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somehow thought we already had that in a base class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its in AlgebraicDecisionTree. I didn't want to include it into TableFactor but I we can use the one implemented in AlgebraicDecisionTree.
I don't see any changes yet - send me an email when I should start CI again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, Yoonwoo!
I will merge, as all unit tests succeed. @varunagrawal there is a possibility this could speed up Hybrid inference by a lot.
FYI, this appears to use boost/format even if boost features are disabled in cmake. |
Summary
TableFactor is a discrete probabilistic factor that can replace DecisionTreeFactor.
It should support all features that the current DecisionTreeFactor has such as multiplication, division, sum, and max.
It was developed for faster MAP inference on CSP and Classical Planning problems where discrete state space is very sparse.
Unittest includes a runtime benchmark between TableFactor and DecisionTreeFactor given various sparsity.
Supports cardinality up to 18446744073709551615.
What is the solution?
Relies on Eigen3's SparseVector data structure. Multiplication and division use the tensor contraction method proposed in SPARTA.
What areas of GTSAM does it impact?
gtsam/discrete
How to test?
run provided unit test (testTableFactor.cpp)
Other Notes
In-depth implementation details are in thesis's chapter 4.
Runtime comparison between DecisionTreeFactor and TableFactor on Macbook pro M1 chip.