class MixedErrorDistribution( ErrorDistribution ) | Source |
---|
To calculate a mixture of two likelihoods.
For one residual, x, it holds
L( x ) = f * L1( x ) + ( 1 - f ) * L2( x )
where f is the contributing fraction while L, L1 and L2 are likelihoods f is a hyperparameter between [0..1]
The likelihood over N datapoints is
L = Π L( x ) = Π( f * L1( x ) + ( 1 - f ) * L2( x ) )
And the log of L is
logL = ∑ logL( x ) = ∑( log( f * L1(x) + ( 1 - f ) * L2(x) ) )
Note
The mixture, i.e. the weighted sum of 2 distributions for each residual, is the raison-d'etre for the methods logLdata and nextPartialData, so individual contributions can be weighted, added, log-ged and summed.
Author Do Kester.
MixedErrorDistribution( errdis1, errdis2, fraction=0.5, limits=None, copy=None ) |
---|
Constructor.
Make a new error distribution as a fraction of errdis1 plus the rest of errdis2.
Parameters
-
errdis1 : ErrorDistribution
First error distribution -
errdis2 : ErrorDistribution
Second error distribution (might be of the same class as errdis1)
It must have the same xdata, data, weights as errdis1. -
fraction : float
contributing fraction -
limits : None or list of 2 floats [low,high]
None : no limits implying fixed fraction
low low limit on fraction ( >0)
high high limit on fraction ( <1)
when limits are set, the scale is not fixed. -
copy : MixedErrorDistribution
distribution to be copied.
copy( ) |
---|
acceptWeight( ) |
---|
logLdata( problem, allpars, mockdata=None ) |
---|
Parameters
- problem : Problem
to be solved - allpars : array_like
list of all parameters in the problem - mockdata : array_like
as calculated for the problem
nextPartialData( problem, allpars, fitIndex, mockdata=None ) |
---|
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 for the problem
Methods inherited from ErrorDistribution |
---|
- getGaussianScale( problem, allpars=None )
- getResiduals( problem, allpars=None )
- getChisq( problem, allpars=None )
- toSigma( scale )
- isBound( )
- keepFixed( fixed=None )
- setPriors( priors )
- setLimits( limits )
- domain2Unit( dval, ks )
- unit2Domain( uval, ks )
- logCLhood( problem, allpars )
- logLhood( problem, allpars )
- partialLogL( problem, allpars, fitIndex )
- partialLogL_alt( problem, allpars, fitIndex )
- numPartialLogL( problem, allpars, fitIndex )
- updateLogL( problem, allpars, parval=None )
- setResult( )
- hyparname( k )