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

Armando Serrano Lombillo arserlom@gmail....
Fri Sep 12 07:09:32 CDT 2008


Hello Michael. norm_gen is not meant to be used, it is just used inside
scipy's code to generate the norm class, which you should use.

For example:

from scipy.stats import norm

norm.rvs(size=n)
norm.pdf(x)

or

d = norm(loc=mean)
d.pdf(x)

or

norm.pdf(x, loc=mean)

or whatever you need to do.

Hope it helps,
Armando.

On Fri, Sep 12, 2008 at 1:02 PM, Michael <mnandris@blueyonder.co.uk> wrote:

>
> > 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
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080912/e81cca0b/attachment.html 


More information about the SciPy-user mailing list