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

Roadmap to 1.0 #88

Closed
DilumAluthge opened this issue Sep 7, 2020 · 4 comments
Closed

Roadmap to 1.0 #88

DilumAluthge opened this issue Sep 7, 2020 · 4 comments

Comments

@DilumAluthge
Copy link

Are there breaking changes that we'd like to make to the public API of MonteCarloMeasurements.jl before releasing version 1.0?

cc: @baggepinnen
cc: @cscherrer

@cscherrer
Copy link

Thanks @DilumAluthge !

I can't think of anything offhand that would be a breaking change, but we should review our use of Particles to make sure it's all as consistent as can be.

There is one thing I'd like to add to MCM that would wrap something like e.g. a Normal(::Particles, ::Particles) and treat the result as a mixture of normals. I'll think some more about this, and should be able to write up the ideas tomorrow. But again, that won't be a breaking change.

@baggepinnen
Copy link
Owner

baggepinnen commented Sep 7, 2020

There are a few inconsistencies I still haven't figured out what to do with:

  • Particles behave like both numbers and distributions, whatever is approprate in a given context. This breaks down for functions that are defined for both, but behave differently. Some of these functions are mean, std, maximum etc., i.e., functions that reduce a collection to a scalar. They are defined for scalars and return the scalar, but for distributions/collections they also return a point. In situations where one of these function are called in scalar code, the current implementation of, e.g., mean, will stop propagating the distributions of Particles after the call to mean, even if this was a noop in the scalar code.
  • Particles should probably not be iterable other than as a scalar.
  • I would also like to try out the stuff in Utilize Blas more  #83, and related, see how far performance can be pushed by having a dedicated MvParticles type represented by a Matrix that reduces the number of allocations, improves cache locality and can make use of BLAS calls for performance. This would be breaking since it causes some functions to return a different type.

@cscherrer
Copy link

* `Particles` behave like both numbers and distributions, whatever is approprate in a given context. This breaks down for functions that are defined for both, but behave differently.

Ouch, yeah this gets complicated very quickly. Seems important to be very careful here about the semantics.

Maybe Particles should always mean a <:Real with uncertainty? Then there could be wrappers to give it semantics of different supertypes, with functions to go between the representations. I think wrapping/unwrapping an immutable struct is a no-op at runtime.

@baggepinnen
Copy link
Owner

The behavior of Particles on master is now following the simple rule "Particles are always scalars, never distributions". This helps a lot with correctness. Most functions that previously treated Particles as a distributions, e.g., mean, std, cov, maximum etc., now have a new function with a prefix p, e.g., pmean, pstd etc. that maintains the old behavior.

A wrapper type around particles to give them distribution semantics like @cscherrer suggested is coming next, but not yet fully functional.

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

No branches or pull requests

3 participants