[Numpy-discussion] Does np.std() make two passes through the data?

Keith Goodman kwgoodman@gmail....
Mon Nov 22 11:28:27 CST 2010


On Mon, Nov 22, 2010 at 9:13 AM,  <josef.pktd@gmail.com> wrote:

> Two pass would provide precision that we would expect in numpy, but I
> don't know if anyone ever tested the NIST problems for basic
> statistics.

Here are the results for their most difficult dataset. But I guess
running one test doesn't mean anything.

http://www.itl.nist.gov/div898/strd/univ/addinfo/numacc4.html

>> np.absolute(a.std(ddof=1) - 0.1)
   5.5884095961911129e-10
>> np.absolute(nanstd_online(a, ddof=1) - 0.1)
   5.5890501948763216e-10
>> np.absolute(nanstd_simple(a, ddof=1) - 0.1)
   nan  # Ha!
>> np.absolute(nanstd_twopass(a, ddof=1) - 0.1)
   5.5879308125117433e-10


More information about the NumPy-Discussion mailing list