UniformErrorDistribution = class UniformErrorDistribution(ScaledErrorDistribution) |
|
UniformErrorDistribution(scale=1.0, limits=None, copy=None)
To calculate a Uniform likelihood, eg. for digitization noise.
For one residual, x, it holds
L( x ) = 1 / ( 2 * s ) if |x| < s
0 otherwise
where s is the scale.
s is a hyperparameter, which might be estimated from the data.
The variance of this function is σ^2 = s / 6.
See: toSigma()
The function is mostly used to calculate the likelihood L over N residuals,
or easier using log likelihood, logL.
logL = -log( 2 * s ) * N
Note that it is required that <b>all</b> residuals are smaller than s,
otherwise the logL becomes -inf.
Using weights this becomes:
logL = -log( 2 * s ) * ∑ w
Author Do Kester. |
|
- Method resolution order:
- UniformErrorDistribution
- ScaledErrorDistribution
- ErrorDistribution
- builtins.object
Constructor:
- UniformErrorDistribution( scale=1.0, limits=None, copy=None )
- Constructor of Uniform Distribution.
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 : UniformErrorDistribution
distribution to be copied.
Methods defined here:
- acceptWeight()
- True if the distribution accepts weights.
Always true for this distribution.
- copy()
- Return copy of this.
- getScale( problem, allpars=None )
- Return the noise scale
Parameters
----------
problem : Problem
to be solved
allpars : array_like
None take parameters from problem.model
list of all parameters in the problem
- logLdata( problem, allpars, mockdata=None )
- Return the log( likelihood ) for each residual
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
- logLikelihood_alt( problem, allpars )
- Return the log( likelihood ) for a Uniform distribution.
Alternate calculation.
Outside the range the likelihood is zero, so the logL should be -inf.
However for computational reasons the maximum negative value is returned.
Parameters
----------
problem : Problem
to be solved
allpars : array_like
parameters of the problem
- nextPartialData( problem, allpars, fitIndex, mockdata=None )
- Return the partial derivative of elements of the log( likelihood )
to the parameters.
dL/ds is not implemented for problems with accuracy
Parameters
----------
problem : Problem
to be solved
allpars : array_like
parameters of the problem
fitIndex : array_like
indices of parameters to be fitted
mockdata : array_like
as calculated by the model
- partialLogL_alt( problem, allpars, fitIndex )
- Return the partial derivative of log( likelihood ) to the parameters.
dL/ds is not implemented for problems with accuracy
Parameters
----------
problem : Problem
to be solved
allpars : array_like
parameters of the problem
fitIndex : array_like
indices of parameters to be fitted
- toSigma( scale )
- Return sigma, the squareroot of the variance.
Parameter
--------
scale : float
the scale of this Uniform distribution.
Methods inherited from ScaledErrorDistribution:
Methods inherited from ErrorDistribution:
- domain2Unit( dval, ks )
- getChisq( problem, allpars=None )
- getGaussianScale( problem, allpars=None )
- getResiduals( problem, allpars=None )
- hyparname( k )
- isBound()
- keepFixed( fixed=None )
- logCLhood( problem, allpars )
- logLhood( problem, allpars )
- numPartialLogL( problem, allpars, fitIndex )
- partialLogL( problem, allpars, fitIndex )
- setPriors( priors )
- setResult()
- unit2Domain( uval, ks )
- updateLogL( problem, allpars, parval=None )
|
|