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

A fairly large reworking to allow entire method objects to be returned #434

Merged
merged 11 commits into from
Nov 9, 2024

Conversation

hyanwong
Copy link
Member

@hyanwong hyanwong commented Nov 9, 2024

This replaces return_posterior, and fixes #410.

It also rationalises some file naming, and moves discrete methods to their own files.

Matches what we do in the variational case, and we don't use this code much now anyway
Fixes tskit-dev#73 . Also adds some debugging comments to variational_gamma
@hyanwong
Copy link
Member Author

hyanwong commented Nov 9, 2024

Once this is in, we can start saving measures of EP convergence in the ExpectationPropagationModel class.

CHANGELOG.md Outdated
**Breaking changes**

- The `return_posteriors` argument has been removed and replaced with `return_model`.
An instance of one of two previously internal classes, `ExpectationPropagationModel`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great! But I have one very pedantic request-- can we not add "Model" to these class names, as they're not models but algorithms to fit models. We could prepend "Algo" or "Fit" instead, or leave as-is.

Copy link
Member Author

@hyanwong hyanwong Nov 9, 2024

Choose a reason for hiding this comment

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

Yeah, I was also a little uncomfortable about "model", but I want to be able to say

ts, something = tsdate.date(ts, mu, return_something=True)

Have you got a better suggestion for "something". I guess as you say, "fit" might work actually?

Copy link
Contributor

Choose a reason for hiding this comment

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

"return_fit" is fine, I think. I'd prefer to keep the class name as "ExpectationPropagation", no need to add a suffix.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. I completely see your point: "fit" is more appropriate and accurate than "model" (as well as it being shorter to type), so thanks for that suggestion.

The equivalent to the "ExpectationPropagation" class is now called "InsideOutside", but I'm not so happy with that name, partly because that fit object is returned from both the inside-outside and the outside-maximisation methods. Do you by any chance have a better suggestion for a name describing that non-variational approach?

Copy link
Member Author

Choose a reason for hiding this comment

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

(Of course, it could be that it's possible to implement EP with the discrete-time method too, but let's cross that bridge later, if we ever come to it)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you by any chance have a better suggestion for a name describing that non-variational approach?

BeliefPropagation?

@hyanwong
Copy link
Member Author

hyanwong commented Nov 9, 2024

Thanks for the useful feedback @nspope : merging so we don't get too out-of-sync.

@hyanwong hyanwong merged commit fb8c726 into tskit-dev:main Nov 9, 2024
3 checks passed
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.

Add return_node_posteriors argument.
2 participants