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

Add SpanningTree properties .mode, .edge_mean #2727

Merged
merged 4 commits into from
Jan 3, 2021

Conversation

fritzo
Copy link
Member

@fritzo fritzo commented Dec 31, 2020

This adds:

  • An .edge_mean property that computes edge marginals. This has a different return shape than the usual .mean properties because SpanningTree returns a packed tensor rather than a binary array. Hence I've named it slightly differently.
  • A .mode property to compute a maximum-weight spanning tree. This has nearly identical implementation to the greedy sample_tree_approx() method (here using argmax rather than sampling), hence I've simply forked that code for implementation.

Tested

  • unit tests for .edge_mean
  • unit tests for .mode
  • larger smoke tests for .mode

@fritzo fritzo changed the title Add SpanningTree methods .mode() .edge_mean() Add SpanningTree properties .mode() .edge_mean() Jan 3, 2021
@fritzo fritzo changed the title Add SpanningTree properties .mode() .edge_mean() Add SpanningTree properties .mode(), .edge_mean() Jan 3, 2021
@fritzo fritzo changed the title Add SpanningTree properties .mode(), .edge_mean() Add SpanningTree properties .mode, .edge_mean Jan 3, 2021
martinjankowiak
martinjankowiak previously approved these changes Jan 3, 2021
pyro/distributions/spanning_tree.py Outdated Show resolved Hide resolved
@martinjankowiak martinjankowiak merged commit a5f1ae6 into dev Jan 3, 2021
@fritzo fritzo deleted the spanning-tree-helpers branch September 27, 2021 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants