octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54619] randi() is biased


From: Juan Pablo Carbajal
Subject: [Octave-bug-tracker] [bug #54619] randi() is biased
Date: Thu, 6 Sep 2018 17:00:17 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #6, bug #54619 (project octave):

For the sake of comparisson I run Rik's code in Julia 1.0.0, I get
thefollowing deviations

++
 0.01408              
 0.04265              
 0.0012799999999999999
 0.01442              
 0.00066              
 0.00251              
 0.01893              
 0.00568              
 0.0005200000000000001
 0.020790000000000003 
--
max 0.04% in bin 2

and a second time
++
 0.00303             
 0.03839             
 0.04325             
 0.02103             
 0.05595             
 0.028669999999999998
 0.03591             
 0.025109999999999997
 0.00456             
 0.0053     
--
max 0.056% in bin 5

In numpy 1.14.2 I get
++
array([0.00682, 0.0383 , 0.02544, 0.02562, 0.05767, 0.01353, 0.07619, 0.04365,
0.00261, 0.01745])
--
max 0.076% at bin 7
and again
++
array([0.00443, 0.05387, 0.01102, 0.06105, 0.0012 , 0.00123, 0.04119, 0.02084,
0.07958, 0.02007])
--
max 0.08% at bin 9

Both are similar to Octave's deviations.

I appreciate the comments from the OP. If he can just illustrate the value of
his suggestion with a working example, then I am pretty somebody will be happy
to improve the method.
It seems there is no agreement on what "serious scientific software" is, at
least Julia and numpy are considered pretty serious.

Julia code:
++
using StatsBase
x = rand(1:10, Int(1e8));
h = fit(Histogram, x, nbins=10, closed=:left)
errpct = abs.(h.weights .- 1e7) / 1e7 * 100
--

Numpy code:
++
import numpy as np
x = np.random.randint(low=1,high=11, size=int(1e8))
nn, xx = np.histogram(x)
errpct = np.abs(nn - 1e7) / 1e7 * 100
--

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54619>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]