class UniformPrior( Prior ) | Source |
---|
Uniform prior distribution, for location parameters.
A uniform prior is a improper prior ( i.e. its integral is unbound ). Because of that it always needs limits, low and high, such that -Inf < low < high < +Inf.
Pr( x ) = 1 / ( high - low ) if low < x < high
0 elsewhere
domain2Unit:
u = ( d - lo ) / range
unit2Domain:
d = u * range + lo
Examples
pr = UniformPrior() # unbound prior
pr = UniformPrior( limits=[0,10] ) # limited to the range [0,10]
pr = UniformPrior( circular=math.pi ) # circular between 0 and pi
pr = UniformPrior( limits=[2,4], circular=True ) # circular between 2 and 4
Attributes
- _range : float
highlimit - lowlimit
Attributes from Prior
lowLimit, highLimit, deltaP, _lowDomain, _highDomain
UniformPrior( limits=None, circular=False, prior=None ) |
---|
Constructor.
Parameters
- limits : None or [float,float]
None no limits are set
2 floats lowlimit and highlimit - circular : bool or float
True : circular with period from limits[0] to limits[1]
float : period of circularity - prior : UniformPrior
to be copied
copy( ) |
---|
Return a (deep) copy of itself.
getIntegral( ) |
---|
domain2Unit( dval ) |
---|
In Prior.limitedDomain2Unit the dval is transformed into a uval
Parameters
- dval : float
value within the domain of a parameter
unit2Domain( uval ) |
---|
In Prior.limitedUnit2Domain the uval is transformed into a dval
Parameters
- uval : float
value within [0,1]
result( x ) |
---|
Parameters
- x : float or array_like
value within the domain of a parameter
partialLog( p ) |
---|
Parameters
- p : float or array_like
the value
isBound( ) |
---|
Return true if the integral over the prior is bound.
shortName( ) |
---|
Return a string representation of the prior.
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( )
- getRange( )
- partialDomain2Unit( p )
- logResult( p )
- numPartialDomain2Unit( dval )
- numPartialLog( p )