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

Hybrid Bayes Net/Tree Optimize #1280

Merged
merged 7 commits into from
Aug 29, 2022
Merged

Hybrid Bayes Net/Tree Optimize #1280

merged 7 commits into from
Aug 29, 2022

Conversation

varunagrawal
Copy link
Collaborator

This PR adds optimize methods for the Hybrid Bayes Net and the Hybrid Bayes Tree.

The idea is that if we know the optimal discrete assignment, we can pick out the Gaussian Bayes Net and just optimize that.

@varunagrawal varunagrawal self-assigned this Aug 26, 2022
@ProfFan
Copy link
Collaborator

ProfFan commented Aug 26, 2022

Optimal discrete assignment needs to be solved by using MPE, CC @xsj01

auto reversed = boost::adaptors::reverse(gbn);
gbn = GaussianBayesNet(reversed.begin(), reversed.end());
#endif

// Return the optimized bayes net.
return gbn.optimize();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean that gbn.optimize does not work when the bayes net has non sequential order?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The GBN needs to be topologically sorted so that it optimizes parents before children, and for some reason, the GBN is reverse topologically sorted only when TBB is enabled.

gbn.push_back(gm(assignment));

} catch (std::exception &exc) {
// if factor at `idx` is discrete-only, just continue.
Copy link
Collaborator

Choose a reason for hiding this comment

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

assert that idx is indeed discrete only

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made the assertion in #1282

@varunagrawal varunagrawal merged commit a6b9554 into develop Aug 29, 2022
@varunagrawal varunagrawal deleted the hybrid/optimize branch August 29, 2022 13:27
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