BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



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( )
Return integral of UniformPrior from lowLimit to highLimit.

domain2Unit( dval )
Return the dval as uval

In Prior.limitedDomain2Unit the dval is transformed into a uval

Parameters

  • dval : float
         value within the domain of a parameter

unit2Domain( uval )
Return the uval as dval

In Prior.limitedUnit2Domain the uval is transformed into a dval

Parameters

  • uval : float
         value within [0,1]

result( x )
Return a the result of the distribution function at x.

Parameters

  • x : float or array_like
         value within the domain of a parameter

partialLog( p )
Return partial derivative of log( Prior ) wrt parameter.

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