-
Notifications
You must be signed in to change notification settings - Fork 432
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
Zipf: let n have type F #1518
Zipf: let n have type F #1518
Conversation
You cannot use the continuous test, because the cdf is not continuous. It does work, if you replace |
This should be mostly ready, but do we want to make this change? Also note: #1517 added a note about casting results to ints being safe as a result of the input bounding the output; the input can now be larger too. |
I am not sure if we should do it. I do not have some quantitative proof for it, but I doubt that for values bigger Another point might be the name. If you search for Zipf, you fill find mostly the Zeta distribution, scipy has our Zipf as Zipfian. Maybe this would be a better name. Edit: I guess there is still a difference to Zeta, because even for |
I'll wait for @vks to comment. |
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.
Looks good, but I'm a bit confused why there is a test failure.
@@ -385,7 +385,7 @@ fn zipf() { | |||
let parameters = [(1000, 1.0), (500, 2.0), (1000, 0.5)]; | |||
|
|||
for (seed, (n, x)) in parameters.into_iter().enumerate() { | |||
let dist = rand_distr::Zipf::new(n, x).unwrap(); | |||
let dist = rand_distr::Zipf::new(n as f64, x).unwrap(); |
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 might as well change the values in parameters
to floats.
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.
No: this is also passed to cdf
which is passed to gen_harmonic
where there's a good reason for usage of an integer type. (Is there a non-recursive approach to calculate this? gen_harmonic
is a finite version of the Riemann-Zeta function.)
Which test failure? Do you have an opinion on the name? Zipf vs Zipfian |
CHANGELOG.md
entrySummary
Change the parameter type of Zipf's
n
toF
Motivation
#1323 (comment)
Details
The CDF test fails:
The value stability tests (only 4 samples; bottom of
zipf.rs
) did not fail.