[SciPy-Dev] Subversion scipy.stats irregular problem with source code example

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Oct 1 14:24:20 EDT 2010


On Fri, Oct 1, 2010 at 1:58 PM, James Phillips <zunzun at zunzun.com> wrote:
> On Fri, Oct 1, 2010 at 7:21 AM, James Phillips <zunzun at zunzun.com> wrote:
>>
>> Here are current timing results fitting both loc and scale...
>
> I'm iterating over all continuous distributions now, and the genetic
> algorithm results are showing which distributions can be run with loc
> = min(data) and scale = max(data) - min(data).  With that information
> in hand I can then speed up the overall fitting considerably by not
> fitting those parameters.

good to hear

I used loc = min(data) - 1e-6  to avoid evaluating the log likelihood
at the lower bound, in some cases this might be infinite.
(I picked 1e-6 arbitrarily)

>>> scipy.stats.gamma.logpdf(np.linspace(0,1,3), 300.5609591140931425, loc=0, scale=0.25)
array([          -Inf, -1205.37511721,  -999.735283  ])

One more: vonmises doesn't define the bounds because it can be used as
a circular distribution. If you want to include it as a regular
distribution, then you should set the bound a and b.
stats.distributions.vonmises.a = -np.pi
stats.distributions.vonmises.b = np.pi

(Even more fun would be to specify a proper Bayesian prior on all
distribution parameters to make the random starting values match the
distribution.)

Josef

>
>     James
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>



More information about the SciPy-Dev mailing list