-
Notifications
You must be signed in to change notification settings - Fork 18
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
Remove overly specialized bundle_samples #120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a concrete example that is fixed by this removal? Removing this definitions seems very breaking. Without this method the return types will be incorrect, won't they? The main point is that the elements are converted to type T
which won't happen anymore.
Nothing is fixed, it's just that
|
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #120 +/- ##
==========================================
- Coverage 97.33% 97.30% -0.03%
==========================================
Files 8 8
Lines 300 297 -3
==========================================
- Hits 292 289 -3
Misses 8 8
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
And this is not even a promise we are making, right? For example, |
An alternative is of course to introudce a AbstractMCMC.bundle_samples_to_vector or something, i.e. just an additional diversion so that overloading for And let me try to clarify a bit the issue I have with the current approach. If you want to overload function AbstractMCMC.bundle_samples(samples, ..., ::Type{T}) where {T}
return actual_bundle_samples(samples, ..., T)
end
function AbstractMCMC.bundle_samples(samples::Vector, ..., ::Type{Vector{T}}) where {T}
return actual_bundle_samples(samples, ..., Vector{T})
end which gets quite annoying. |
I've been annoyed by downstream issues/annoyances of the |
Oooh AbstractMCMC is already on x.y.z versioning! I was thinking bumping minor version was a breaking release, and so was confused why you were talking about how this should be a breaking release thinking I'd already indicated so.
And yeah, happy to spend a few days thinking aobut whether or not this is the way to go 👍 Should we maybe make an issue or discussion? |
When you refer to the "output type in the sample call", are you talking about the And btw, a lot of these PRs are motivated by "annoyances" I've encountered when working on MCMCTempering.jl, where we have several "meta-samplers", i.e. samplers which call other sampler in some way. In MCMCTempering.jl we have a Another particularly "weird" case where In this case, the samples correspond to samples from a product of models, and so it represents an ordered sequence of samples rather than a single one. But the sequence is ordered according to an "index process", which is not necessarily equal to the model-ordering (which is what you'd expect as a user). To "handle" this in a somewhat more convenient manner for the user, we've added a kwarg to
Do you mean completely removing it and just not doing anything with the samples, leaving that to the sampler-implementer? If so, I'm not a big fan, in particular not now that we have extensions and people can easily add impls for MCMCChains, etc.
What we could always do, though it has to be done with care, is to add some simpler function bundle_samples(
samples, ::AbstractModel, ::AbstractSampler, ::Any, output_type::Type; kwargs...
)
return bundle_samples(samples, output_type; kwargs...)
end and then just make the default implementation we complained about above function bundle_samples(samples::Vector, ::Type{Vector{T}}; kwargs...) where {T}
return map(samples) do sample
convert(T, sample)
end
end I believe in most (but not all) scenarions, one would really only overload the latter implementation. |
@devmotion Could we revisit this?:) |
I'm still unhappy. The least this should be moved to a breaking 5.0.0 release. However, I wonder - could we just move the functionality to the body of the generic fallback, wrapped in a |
Since #123 was merged, I suggest closing this PR for now and revisit it (or some variant of it) if these ambiguity issues show up again. |
Sounds good 👍 |
Related: #118