-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Implement triangular distribution #575
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.
Also needs some kind of value-stability test.
|
||
#[test] | ||
fn test_new() { | ||
for &(min, max, mode) in &[ |
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.
This test does very little...
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.
It just tests that the asserts are implemented correctly. I ported the test from statrs.
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.
So you're just copying from statrs
. I wondered. Why?
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.
You mean this test specifically or the distribution in general?
let norm = Triangular::new(0., 1., 0.5); | ||
let mut rng = ::test::rng(1); | ||
for _ in 0..1000 { | ||
norm.sample(&mut rng); |
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.
This also doesn't do much. It could at least test the mean.
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.
Fair enough. This is the status quo of most distribution tests in Rand though.
In principle we should use histograms and test against the PDF. (I plan to work on that in the midterm, probably after implementing PDFs for #290 and by generalizing tests/uniformity.rs
.)
Yes, I think it can be merged. The tests can be added later and are needed for the existing distributions as well. I think only concern is that we might not want to expose new distributions for 0.6 and rather move them to a |
No description provided.