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

[Feature]: add support for Gumbel Distribution #189

Closed
wiseaidev opened this issue May 19, 2023 · 6 comments
Closed

[Feature]: add support for Gumbel Distribution #189

wiseaidev opened this issue May 19, 2023 · 6 comments
Assignees

Comments

@wiseaidev
Copy link

wiseaidev commented May 19, 2023

Hey everyone! I have been using this library for quite a while now, and I noticed that It doesn't support some distribution functions like Exponential and Gumbel. I think one way to add support for missing distributions is by migrating from rand to rand_distr. What do you think?

Edit 1: I am thinking about a relationship between, for instance, Poisson and Exponential Distributions. Probably there is one and I can compute one from another. Know what I am saying?

Edit 2: Oh, wait! It is called Exp.

@wiseaidev wiseaidev changed the title [Feature]: add support for Exponential and Gumbel Distributions [Feature]: add support for Gumbel Distribution May 19, 2023
@YeungOnion
Copy link
Contributor

This could be useful.

This distribution would probably need to implement the following traits

  • derive
    • Debug
    • Copy
    • Clone
    • PartialEq
  • distribution::Continuous<f64, f64>
  • distribution::ContinuousCDF<f64, f64>
  • statistics::{Min, Max, Mean, Median, Mode}
  • ::rand::distributions::Distribution<f64>
  • statistics::Distribution

all methods seem like they should be based on closed form expressions, perhaps with considerations for numerical stability of

  • double exponential, especially with pdf
  • double logarithms, if directly using them in inverse_cdf

@YeungOnion
Copy link
Contributor

Since it wasn't straightforward to find the exponential distribution as Exp could be a short PR to add a doc alias for "exponential". See rustdoc docs on #[doc] and in our crate, #174 and eb0745e

@soumyasen1809
Copy link
Contributor

Hi @YeungOnion I am new to Rust and would want to take a shot at this issue. Is it possible to work on adding Gumbel distribution?

@YeungOnion
Copy link
Contributor

Absolutely! Feel free to ping me here for any help. Also, as you're new, I'd like to mention the Rust Language forum.

For consistency, I request that the error type you create for this distribution should have an error message from Display with language that describes the unexpected input, as opposed to what it is not. Some truncated examples from other error messages in the project.

  • "is NAN or is outside [0,1]" instead of "must be on [0,1]"
  • "shape and scale are both inf" instead of "must have finite shape or finite scale"

@soumyasen1809
Copy link
Contributor

@YeungOnion I have a PR for this issue
#285

@YeungOnion
Copy link
Contributor

Closed by #285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants