Skip to content

Add test_DCSAM.py and HybridInference.ipynb example notebook#2469

Draft
Copilot wants to merge 3 commits intofix-examplesfrom
copilot/sub-pr-2454
Draft

Add test_DCSAM.py and HybridInference.ipynb example notebook#2469
Copilot wants to merge 3 commits intofix-examplesfrom
copilot/sub-pr-2454

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

Adds Python-level coverage for DCSAM and a user-facing hybrid inference tutorial, both missing from the current codebase.

python/gtsam/tests/test_DCSAM.py

Five unit tests translated from gtsam/hybrid/tests/testDCSAM.cpp:

Test What it covers
test_constructor Default and ISAM2Params-based construction
test_simple_discrete Pure discrete MPE via DecisionTreeFactor
test_simple_mixture_factor HybridNonlinearFactor with log-normalisation constants; verifies tighter-prior mode wins
test_simple_slam_batch 8-pose Pose2 SLAM batch solve; checked against C++ reference values
test_simple_slam_incremental Same trajectory added one pose at a time
dcsam = DCSAM()
initial_guess = HybridValues(VectorValues(), DiscreteValues(), initial_continuous)
dcsam.update(graph, initial_guess)
dcvals = dcsam.calculateEstimate()
self.gtsamAssertEquals(dcvals.nonlinear(), expected, 1e-5)

python/gtsam/examples/HybridInference.ipynb

Three-part tutorial notebook:

  1. Discrete-onlyDecisionTreeFactor MPE via DCSAM
  2. Continuous-only SLAMDCSAM as thin iSAM2 wrapper for Pose2 odometry
  3. True hybrid inference — binary motion mode (normal vs. slippery surface) via HybridNonlinearFactor; demonstrates joint pose + discrete mode estimation with matplotlib visualisation

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: dellaert <10515273+dellaert@users.noreply.github.com>
Copilot AI changed the title [WIP] Wrap DCSAM class and remove hybrid examples Add test_DCSAM.py and HybridInference.ipynb example notebook Mar 13, 2026
Copilot AI requested a review from dellaert March 13, 2026 18:13
@dellaert
Copy link
Member

@copilot the discrete only and continuous only examples are of less interest. I like the octagon, though. Can we just create one example, an octagon with switching motion models?

Copy link
Contributor Author

Copilot AI commented Mar 13, 2026

@dellaert The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 04de8f4c-33af-4c02-a326-fde0cdb59780

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.

the discrete only and continuous only examples are of less interest. I like the octagon, though. Can we just create one example, an octagon with switching motion models?

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