[SciPy-user] Why doesn't norm_gen have a 'dist' attribute?

Michael mnandris@blueyonder.co...
Fri Sep 12 06:02:02 CDT 2008


> Message: 2
> Date: Wed, 10 Sep 2008 23:05:30 -0500
> From: "Robert Kern" <robert.kern@gmail.com>
> Subject: Re: [SciPy-user] examples of using norm_gen
> To: "SciPy Users List" <scipy-user@scipy.org>
> Message-ID:
> 	<3d375d730809102105v167195ceuf8c0cf9e725c5059@mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
> On Wed, Sep 10, 2008 at 19:41, SimonPalmer <simon.palmer@gmail.com> wrote:
> > can anyone point me in the direction of examples of how to use norm/
> > norm_gen from the scipy.stats.distributions module?
> 
> The docstring gives a good overview of its capabilities. Is there
> something specific you found confusing or inadequate about it?

norm_gen doesn't appear to _generate_ anything, not directly anyway

a=d.norm_gen(name='norm',longname='a normal') 
a is <class 'scipy.stats.distributions.norm_gen'>
b=d.norm(x,size=n) 				
b is <class 'scipy.stats.distributions.rv_frozen'>

both a and b produce normal distributions that don't 'look' normal - see
attached, though this is a bad test since the beta distribution looks
totally mangled but is correc

pdf1=a.pdf(x,size=n)
pdf2=b.dist.pdf(x,size=n) 

Leaving norm_gen aside for a moment, c.f. the lack of the 'dist'
attribute in 'a', one might also ask: what the dist attribute does?
Where did it spring from? there's too much padding in the scipy
sandwich, so to speak;

e.g. the sheer number of ways of creating scipy distributions is
slightly baffling; afaik norm_gen is a base class that is not to be used
directly... but that's just a guess.

That said, there is an 85-100 fold speed-up over using a np.random
distribution + np.histogram

Is there a guide somewhere explaining how scientific python api's are
packaged/structured? import idioms?


> -- 
> Robert Kern
> 
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>  -- Umberto Eco

-------------- next part --------------
A non-text attachment was scrubbed...
Name: norm.py
Type: text/x-python
Size: 489 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20080912/473bda9a/attachment.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20080912/473bda9a/attachment.bin 


More information about the SciPy-user mailing list