Skip to content

968 adapt mnle to new densityestimator abstraction - #1089

Merged
michaeldeistler merged 15 commits into
mainfrom
968-adapt-mnle-to-new-densityestimator-abstraction
Mar 22, 2024
Merged

michaeldeistler merged 15 commits into
mainfrom
968-adapt-mnle-to-new-densityestimator-abstraction

Conversation

@coschroeder

@coschroeder coschroeder commented Mar 22, 2024 •

Copy link
Copy Markdown
Collaborator

What does this implement/fix? Explain your changes

restructured MNLE/categorical distributions and adapted to new framework

Does this close any currently open issues?

Fixes # (issue)

Any relevant code examples, logs, error output, etc?

...

Any other comments?

...

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.

  • I have read and understood the contribution
    guidelines
  • I agree with re-licensing my contribution from AGPLv3 to Apache-2.0.
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have reported how long the new tests run and potentially marked them
    with pytest.mark.slow.
  • New and existing unit tests pass locally with my changes
  • I performed linting and formatting as described in the contribution
    guidelines
  • I rebased on main (or there are no conflicts with main)

coschroeder and others added 12 commits March 21, 2024 09:32
* copy previous getting started

* merged linear gaussian 0 and 1

* merged added docs and log prob and new pair plot example

* work in jans comment, restructure next steps

* add tutorial instruction landing page

* added separation users / devs and links to all notebooks

* replace one line example by multi line code example

* fix comma

* fix space, fix simulation-based science wording

---------

Co-authored-by: augustes <[email protected]>
…github.com:sbi-dev/sbi into 968-adapt-mnle-to-new-densityestimator-abstraction
@coschroeder coschroeder linked an issue Mar 22, 2024 that may be closed by this pull request

@michaeldeistler michaeldeistler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve because tests are passing. Important dependency for #1066

)


class CategoricalMassEstimator(DensityEstimator):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 for this!

"""

def __init__(self, net: CategoricalNet) -> None:
super().__init__(net=net, condition_shape=torch.Size([]))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why such a weird condition_shape?

@coschroeder coschroeder Mar 22, 2024 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

None was failing the type checking.
but this will be removed anyway later on

discrete_x = self.discrete_net.sample(
sample_shape=sample_shape,
context=context,
).reshape(sample_shape[0], -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reshape to (*sample_shape, -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

or is this supposed to be numel(sample_shape)?

(context.repeat(sample_shape[0], 1), discrete_x), dim=1
),
sample_shape=sample_shape,
).reshape(sample_shape[0], -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same as above

@michaeldeistler
michaeldeistler merged commit b81420b into main Mar 22, 2024
@michaeldeistler
michaeldeistler deleted the 968-adapt-mnle-to-new-densityestimator-abstraction branch March 22, 2024 12:14
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.

Adapt MNLE to new DensityEstimator abstraction

4 participants