class LaplacePrior( Prior ) | Source |
---|
Laplace prior distribution.
Pr( x ) = 1 / ( 2 s ) exp( - |x - c| / s )
By default: c = center = 0.0 and s = scale = 1.
It can also have a limited domain. By default the domain is [-Inf,+Inf]. In computational practice the domain is limited to about [-36,36] scale units
Equivalent to a double-sided exponential prior
domain2unit:
u = 0.5 * exp( ( d - c ) / scale ) if d < c
1.0 - 0.5 * exp( ( c - d ) / scale ) otherwise
unit2domain:
d = c + log( 2 * u ) * scale if u < 0.5
c - log( 2 * ( 1 - u ) ) * scale otherwise
Examples
pr = LaplacePrior() # center=0, scale=1
pr = LaplacePrior( center=1.0, scale=0.5 )
pr = LaplacePrior( limits=[0,None] ) # limites to values >= 0
pr = LaplacePrior( center=1, circular=3 ) # circular between 0.5 and 2.5
Attributes
- center : float
center of the Laplace prior - scale : float
scale of the Laplace prior
Attributes from Prior
lowLimit, highLimit, deltaP, _lowDomain, _highDomain
lowLimit and highLimit cannot be used in this implementation.
LaplacePrior( center=0.0, scale=1.0, limits=None, circular=False, prior=None ) |
---|
Constructor.
Parameters
- center : float
of the prior - scale : float
of the prior - limits : None or list of 2 float/None
None : no limits.
2 limits, resp low and high - circular : bool or float
bool : y|n circular with period from limits[0] to limits[1]
float :period of circularity - prior : LaplacePrior
prior to copy (with new scale if applicable)
copy( ) |
---|
domain2Unit( dval ) |
---|
u = 0.5 * exp( ( d - c ) / s ) if d < c else
1.0 - 0.5 * exp( ( c - d ) / s )
Parameters
- dval : float
value within the domain of a parameter
unit2Domain( uval ) |
---|
d = c + log( 2 * u ) * scale if u < 0.5 else
c - log( 2 * ( 1 - u ) ) * scale
Parameters
- uval : float
value within [0,1]
result( x ) |
---|
Parameters
- x : float
value within the domain of a parameter
logResult( x ) |
---|
Parameters
- x : float
value within the domain of a parameter
partialLog( x ) |
---|
Parameters
- x : float
the value
isBound( ) |
---|
Return true if the integral over the prior is bound.
shortName( ) |
---|
Methods inherited from Prior |
---|
- limitedIntegral( center=0, circular=False, limits=None )
- setLimits( limits=None )
- setPriorAttributes( limits, circular )
- isCircular( )
- limitedDomain2Unit( dval )
- limitedUnit2Domain( uval )
- circularDomain2Unit( dval )
- circularUnit2Domain( uval )
- unsetLimits( )
- setAttributes( limits=None, scale=None )
- isOutOfLimits( par )
- checkLimit( par )
- stayInLimits( par )
- hasLowLimit( )
- hasHighLimit( )
- hasLimits( )
- getLimits( )
- getIntegral( )
- getRange( )
- partialDomain2Unit( p )
- numPartialDomain2Unit( dval )
- numPartialLog( p )