[SciPy-dev] random seed in scipy.stats

Hoyt Koepke hoytak at gmail.com
Tue Apr 29 15:20:49 EDT 2008


Okay, I have a patch together that does the above.  I've been using it
in my code for the past week or so, and I'm happy with how it works.
If someone with svn commit access could review it and commit it, that
would be helpful.

It allows users to specify a RandomState object to use in calculating
the random samples in the stats code.  It defaults to the previous
behavior of drawing them directly from the numpy.random module, so it
shouldn't break any backwards compatibility.  There is also full test
coverage.

I'm a bit new to the process of submitting patches like this. The
attached is a tarball of three svndiff  outputs.  In general, is that
the best way to submit a patch?  I plan on contributing to scipy more
in the future, so I want to get the process right from the start.

Thanks!
--Hoyt



On Sun, Apr 20, 2008 at 8:50 PM, Hoyt Koepke <hoytak at gmail.com> wrote:
> Oops -- ignore the line in the diff that says "reshape(, size..."  --
>  I was playing around with having it return a scalar and forgot to undo
>  it before taking the diff.
>
>  --Hoyt
>
>
>
>  On Sun, Apr 20, 2008 at 8:46 PM, Hoyt Koepke <hoytak at gmail.com> wrote:
>  > Hello,
>  >
>  >  I've got the changes done, complete with test coverage.   I also
>  >  cleaned up a few minor coding things that make it easier to read the
>  >  code but don't change the behavior.  I'll attach the diff if anyone is
>  >  curious / wants to give me feedback.
>  >
>  >  However, I have a quick question about something that strikes me as
>  >  rather odd behavior.  When rvs() is called with no size or a size of 1
>  >  it returns a python array of size (1,).  I find this odd for two
>  >  reasons:
>  >
>  >  1.  It's inconsistent with numpy.random
>  >  2.  One of the unit tests in test_distributions.py tests to make sure
>  >  the default returns a scalar (it now fails).
>  >
>  >  While I'm at it, should I change this behavior?  It seems like it
>  >  could break some backwards compatibility stuff, so I'll leave it for
>  >  everyone else to decide.
>  >
>  >
>  >
>  > -- Hoyt
>  >
>  >  +++++++++++++++++++++++++++++++++++
>  >  Hoyt Koepke
>  >  UBC Department of Computer Science
>  >  http://www.cs.ubc.ca/~hoytak/
>  >  hoytak at gmail.com
>  >  +++++++++++++++++++++++++++++++++++
>  >
>
>
>
>  --
>
>
> +++++++++++++++++++++++++++++++++++
>  Hoyt Koepke
>  UBC Department of Computer Science
>  http://www.cs.ubc.ca/~hoytak/
>  hoytak at gmail.com
>  +++++++++++++++++++++++++++++++++++
>



-- 
+++++++++++++++++++++++++++++++++++
Hoyt Koepke
UBC Department of Computer Science
http://www.cs.ubc.ca/~hoytak/
hoytak at gmail.com
+++++++++++++++++++++++++++++++++++
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stats_rng_patch.tar.gz
Type: application/x-gzip
Size: 8500 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20080429/9275995b/attachment.bin>


More information about the SciPy-Dev mailing list