-
Notifications
You must be signed in to change notification settings - Fork 864
New docs: hybrid #2120
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
base: develop
Are you sure you want to change the base?
New docs: hybrid #2120
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.
Thanks @p-zach !!! I fixed all remaining wrapper issues
@varunagrawal FYI |
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.
Okay this PR is a very nice effort, but I am not comfortable with the wrapping for 2 reasons:
- Lack of tests: whatever I wrapped, I extensively unit tested, and my own work allowed for integration testing.
- Verification with the Matlab wrapper. The matlab wrapper is more finicky than the python wrapper since it cares a whole lot more about return types and other smaller details. I don't see if this was checked (CI doesn't do it).
Moreover, I want to land other hybrid related PRs first (such as DCSAM) and include a new class called Key[Algebraic]DecisionTree
which specializes AlgebraicDecisionTree<Key>
to make its use much easier and cleaner. It's a low priority item since it simplifies the API but is a lot of effort for a single developer (aka me).
I am not selecting Request changes
(which would be the right way to go), but I DO NOT recommend merging this yet.
uses: pierotofy/set-swap-space@master | ||
with: | ||
swap-size-gb: 8 | ||
shell: bash |
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.
Can you please document what's going on here? It's much more complicated than what we had before and is not quite obvious.
|
||
/* ************************************************************************ */ | ||
double HybridConditional::error(const HybridValues &values) const { | ||
double HybridConditional::error(const HybridValues &hybridValues) const { |
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.
This change is a bit superficial since HybridConditional::error
only ever accepts HybridValues
.
template <> | ||
struct traits<HybridFactor> : public Testable<HybridFactor> {}; | ||
|
||
// For wrapper: |
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.
The reason I haven't wrapped a lot of stuff in hybrid is primarily because of this class, and also because I want to add a new class called KeyDecisionTree
which specializes the template AlgebraicDecisionTree
.
This would have many benefits since we wouldn't have to always pass in keyFormatter
arguments, and wrapping would be a cinch, but it is a big PR which is lower priority than some others (such as DCSAM).
DiscreteKeys newFactorDiscreteKeys; // For the new, restricted factor | ||
|
||
// Iterate over the discrete keys of the current factor | ||
for (const DiscreteKey& factor_dk_pair : currentFactorDiscreteKeys) { |
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.
Nitpick: The iterate can simply be called discreteKey
.
const Key& key = factor_dk_pair.first; | ||
|
||
// Check if this key is specified in the assignment | ||
auto assignment_it = assignment.find(key); |
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.
This can be combined with the below line
if (assignment.find(key) != assignment.end()) {
and since assignment
is a std::map, you can just do assignment.at(key)
to get the assigned index. You shouldn't need the iterator assignment_it
.
const std::vector<std::pair<gtsam::Vector, double>>& parameters); | ||
|
||
// Standard API | ||
gtsam::GaussianConditional::shared_ptr choose( |
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.
shared_ptr
has specific wrapper syntax: gtsam::GaussianConditional*
.
Also did you test the matlab wrapper?
const gtsam::VectorValues& frontals) const; | ||
double logProbability(const gtsam::HybridValues& values) const; | ||
double evaluate(const gtsam::HybridValues& values) const; | ||
// double operator()(const gtsam::HybridValues &values) const; |
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.
This should just work right?
} | ||
|
||
/* ************************************************************************* */ | ||
TEST(HybridBayesTree, EliminateMultifrontal) { |
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.
This test doesn't seem to be verifying correctness. Seems more like a test for dot printing.
|
||
// Check discrete keys now empty | ||
DiscreteKeys expected_dk1; | ||
GTSAM_PRINT(restricted->discreteKeys()); |
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.
Please kill prints.
/** private helper method for saving the Tree to a text file in GraphViz format */ | ||
void dot(std::ostream &s, sharedClique clique, const KeyFormatter& keyFormatter, | ||
int parentnum = 0) const; | ||
size_t parentnum = 0) const; |
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.
This may be problematic on different compilers due to the platform dependent size_t
definitions.
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.
Please verify the matlab wrapper compiles and update the restrict method.
New docs for hybrid folder. There were a lot of classes in here that had many, many functions that were not yet wrapped. Frank also exposed
AlgebraicDecisionTreeKey
for methods like errorTree().Finished Notebooks