| class GaussErrorDistribution( ScaledErrorDistribution ) | Source |
|---|
To calculate a Gauss likelihood.
For one residual, x, it holds
L( x ) = 1 / √( 2 π s2 ) exp( - 0.5 ( x / s )2 )
where s is the scale. s is a hyperparameter, which might be estimated from the data.
The scale s is also the square root of the variance of this error distribution.
The function is mostly used to calculate the likelihood L over N residuals, or easier to use log likelihood, logL.
logL = log( N / ( √( 2 π ) s ) ) - 0.5 ∑( x / s )2
Using weights this becomes
logL = log( ∑( w ) / ( √( 2 π ) s ) ) - 0.5 ∑( w ( x / s )2 )
Author Do Kester.
| GaussErrorDistribution( scale=1.0, limits=None, copy=None ) |
|---|
Default Constructor.
Parameters
-
scale : float
noise scale -
limits : None or list of 2 floats [low,high]
None : no limits implying fixed scale
low low limit on scale (needs to be >0)
high high limit on scale
when limits are set, the scale is not fixed. -
copy : GaussErrorDistribution
distribution to be copied.
| copy( ) |
|---|
| acceptWeight( ) |
|---|
| getScale( problem, allpars=None ) |
|---|
Parameters
- problem : Problem
to be solved - allpars : array_like
None take parameters from problem.model
list of all parameters in the problem
| logLikelihood_alt( problem, allpars ) |
|---|
Alternate calculation
Parameters
- problem : Problem
to be solved - allpars : array_like
list of all parameters in the problem
| logLdata( problem, allpars, mockdata=None ) |
|---|
logL = sum( logLdata )
Parameters
- problem : Problem
to be solved - allpars : array_like
list of all parameters in the problem - mockdata : array_like
as calculated by the model
| partialLogL_alt( problem, allpars, fitIndex ) |
|---|
Alternate calculation
Parameters
- problem : Problem
to be solved. - allpars : array_like
(hyper)parameters of the problem - fitIndex : array_like
indices of parameters to be fitted
| nextPartialData( problem, allpars, fitIndex, mockdata=None ) |
|---|
Parameters
- problem : Problem
to be solved - allpars : array_like
(hyper)parameters of the problem - fitIndex : array_like of int
indices of allpars to fit - mockdata : array_like
as calculated for the problem
| hessianLogL( problem, allpars, fitIndex ) |
|---|
The hessian is a matrix containing the second derivatives to each of the parameters.
hessian = d2 logL / dpi dpk
Parameters
- problem : Problem
to be solved - allpars : array_like
(hyper)parameters of the problem - fitIndex : array_like of int
indices of allpars to fit
| Methods inherited from ScaledErrorDistribution |
|---|
| Methods inherited from ErrorDistribution |
|---|
- getGaussianScale( problem, allpars=None )
- getResiduals( problem, allpars=None )
- getChisq( problem, allpars=None )
- toSigma( scale )
- isBound( )
- keepFixed( fixed=None )
- setPriors( priors )
- domain2Unit( dval, ks )
- unit2Domain( uval, ks )
- logCLhood( problem, allpars )
- logLhood( problem, allpars )
- partialLogL( problem, allpars, fitIndex )
- numPartialLogL( problem, allpars, fitIndex )
- updateLogL( problem, allpars, parval=None )
- setResult( )
- hyparname( k )