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

More refactoring #1853

Merged
merged 14 commits into from
Sep 29, 2024
Merged

More refactoring #1853

merged 14 commits into from
Sep 29, 2024

Conversation

dellaert
Copy link
Member

  • added eliminate as method of HGFG to test in isolation
  • moved HBN test to right place
  • added three "bougie" constructors that considerably simplify tests and later examples:
/// Construct from mean `mu_i` and `sigma_i`.
  HybridGaussianConditional(
      const DiscreteKey mode, Key key,  //
      const std::vector<std::pair<Vector, double>> &parameters);

  /// Construct from conditional mean `A1 p1 + b_i` and `sigma_i`.
  HybridGaussianConditional(
      const DiscreteKey mode, Key key,  //
      const Matrix &A, Key parent,
      const std::vector<std::pair<Vector, double>> &parameters);

  /// Construct from conditional mean `A1 p1 + A2 p2 + b_i` and `sigma_i`.
  HybridGaussianConditional(
      const DiscreteKey mode, Key key,  //
      const Matrix &A1, Key parent1, const Matrix &A2, Key parent2,
      const std::vector<std::pair<Vector, double>> &parameters);

Copy link
Collaborator

@varunagrawal varunagrawal left a comment

Choose a reason for hiding this comment

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

Approve modulo comments.

I like the new API but it would also be nice to have at least one test using the old API as a tutorial, aka "this is good, this new thing is better".

gtsam/hybrid/HybridGaussianConditional.h Outdated Show resolved Hide resolved
gtsam/hybrid/HybridGaussianConditional.cpp Outdated Show resolved Hide resolved
gtsam/hybrid/HybridGaussianConditional.cpp Show resolved Hide resolved
gtsam/hybrid/HybridGaussianFactorGraph.cpp Show resolved Hide resolved
@@ -436,7 +435,7 @@ hybridElimination(const HybridGaussianFactorGraph &factors,
*/
std::pair<HybridConditional::shared_ptr, std::shared_ptr<Factor>> //
EliminateHybrid(const HybridGaussianFactorGraph &factors,
const Ordering &frontalKeys) {
const Ordering &keys) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This deviates from the naming scheme of GaussianFactorGraph and other graphs, where it is frontalKeys. Should we strive for consistency?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I’ll fix

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, no,I went back and looked at GFG and it's always just "keys". So I'll leave this to be consistent. frontal keys is a concept in conditionals, not in elimination. The keys we eliminate will become frontal keys.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh okay. I must have been mistaken then.

gtsam/hybrid/tests/testGaussianMixture.cpp Outdated Show resolved Hide resolved
gtsam/hybrid/tests/testGaussianMixture.cpp Outdated Show resolved Hide resolved
@dellaert
Copy link
Member Author

I’ll address the comments. But

  • I don’t want the separators between the constructors
  • The includes should not depend on transitive inclusion, see Google style guide
    Maybe let me edit to avoid conflicts? You have enough to do with experiments :-)

@varunagrawal
Copy link
Collaborator

Sure thing wrt the dividers. It's a nitpick anyway :)

@varunagrawal
Copy link
Collaborator

  • The includes should not depend on transitive inclusion, see Google style guide

Interesting. I like to minimize includes since that helps cut down compilation time. Less header copying.

Maybe let me edit to avoid conflicts? You have enough to do with experiments :-)

Fair. I was updating the code to examine the ordering, so decided to save a compilation cycle by making the edits.

@dellaert dellaert merged commit ffb2829 into develop Sep 29, 2024
33 checks passed
@dellaert dellaert deleted the feature/bougie_constructors branch September 29, 2024 18:43
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