BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class WalkerList( list )Source

WalkerList is a list of Walker.

It is the working ensemble of NestedSampler.

Attributes

  • logZ : float (read-only)
         Natural log of evidence
  • info : float (read-only)
         The information H. The compression factor ( the ratio of the prior space
         available to the model parameters over the posterior space ) is equal to the exp( H ).
  • iteration : int
         Present iteration number.

Author Do Kester

WalkerList( problem=None, ensemble=0, allpars=None, fitIndex=None, walker=None, walkerlist=None )

Constructor.

To be valid it needs either problem/allpars/fitindex or walker or walkerlist

Parameters

  • problem : Problem or None
         to construct a walker to be added.
  • ensemble : int
         number of walkers
  • allpars : array_like
         parameters of the problem
  • fitIndex : array of int
         list of parameters to be fitted.
  • walker : Walker or None
         walker to be added.
  • walkerlist : Walkerlist or None
         walkerlist to be incorporated.

addWalkers( walker, ensemble )

setWalker( walker, index )
replace/append a Walker to this list

Parameters

  • walker : Walker
         the list to take to copy from
  • index : int
         the index at which to set

copy( src, des, wlist=None, start=0 )
Copy one item of the list onto another.

Parameters

  • src : int
         the source item
  • des : int
         the destination item
  • wlist : WalkerList or None
         Copy from this WalkerList (None == self)
  • start : int
         iteration where this walker was created

logPlus( x, y )
Return the log of sum.

firstIndex( lowL )
Return index of the first walker with walker.logL > lowL,
         None if list is empty
         len if no item applies

Parameters

  • lowL : float
         low Likelihood

insertWalker( walker )
Insert walker to this list keeping it sorted in logL

Parameters

  • walker : Walker
         the list to take to copy from

cropOnLow( lowL )
Return WalkerList with all LogL > lowL

Precondition: self is ordered on logL

Parameters

  • lowL : float
         low Likelihood

getLogL( walker=None )
Return the logL of the/all walker

Parameters

  • walker : None or Walker
         None return value for all walkers
         get the logL from

allPars( )
Return a 2d array of all parameters.

In case of dynamic models the number of parameters may vary. They are zero-padded. Use getNumberOfParametersEvolution to get the actual number.

Parameters

  • kpar : int or tuple of ints
         the parameter to be selected. Default: all

getParameterEvolution( kpar=None )
Return the evolution of one or all parameters.

In case of dynamic models the number of parameters may vary. They are zero-padded. Use getNumberOfParametersEvolution to get the actual number.

Parameters

  • kpar : int or tuple of ints
         the parameter to be selected. Default: all

getScaleEvolution( )

Return the evolution of the scale.

getLogLikelihoodEvolution( )

Return the evolution of the log( Likelihood ).

getLowLogL( )
Return the lowest value of logL in the walkerlist, plus its index.