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

Refactor Normal class to compositional pattern #145

Closed
JonathanWenger opened this issue Aug 17, 2020 · 1 comment · Fixed by #164
Closed

Refactor Normal class to compositional pattern #145

JonathanWenger opened this issue Aug 17, 2020 · 1 comment · Fixed by #164
Assignees
Labels
randvars Issues related to random variables refactoring Refactoring of existing functionality

Comments

@JonathanWenger
Copy link
Contributor

Instead of having a class hierarchy create a single Normal class which in its constructor composes different versions of normal by passing different implementations of sample, pdf, ...

This ensures that

  • if x=Normal(mean, cov) is called, the type of x is Normal
  • the user does not need to care about different types of normal distributions

The different classes implementing different normal distributions currently only exist to implement efficient sampling, pdf computation, etc. The refactored class would have one large __init__ but the rest of the class is simpler.

@JonathanWenger JonathanWenger added refactoring Refactoring of existing functionality randvars Issues related to random variables labels Aug 17, 2020
@marvinpfoertner marvinpfoertner self-assigned this Aug 17, 2020
@JonathanWenger JonathanWenger linked a pull request Aug 20, 2020 that will close this issue
@pnkraemer
Copy link
Collaborator

I am intrigued what comes out because a similar pattern is used in Kalman, ExtendedKalman and UnscentedKalman. I suppose that if it is a clear improvement here, it could be a clear improvement there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
randvars Issues related to random variables refactoring Refactoring of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants