BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class GalileanEngine( Engine )[source]

Move all parameters in forward steps, with optional mirroring on the edge.

Move the parameters in a random direction for N iterations; mirror the direction on the gradient of the logLikelihood when the parameters enter the zone of logLlow.

Attributes

  • size : float (0.5)
         adaptable fraction for the (unit) direction of the stepping
  • wiggle : float (0.2)
         factor to perturb the direction at each step.
         between 0 (no perturbation) and 1 (new direction)

Attributes from Engine
walkers, errdis, maxtrials, nstep, slow, rng, report, phancol, verbose

Author Do Kester.

GalileanEngine( walkers, errdis, copy=None, **kwargs ) [source]

Default Constructor.

Parameters

  • walkers : WalkerList
         walkers to be diffused
  • errdis : ErrorDistribution
         error distribution to be used
  • copy : GalileanEngine
         to be copied
  • kwargs : for Engine
         "phancol", "slow", "seed", "verbose"

copy( ) [source]

execute( kw, lowLhood, iteration=0 ) [source]
Execute the engine by diffusing the parameters.

Parameters

  • kw : int
         index in walkerlist, of the walker
  • lowLhood : float
         lower limit in logLikelihood

Returns

  • int : the number of successfull moves

incsize( ) [source]

Return increased self.size

decsize( ) [source]

Return decreased self.size.

findEdge( problem, ptry, fitIndex, Lhood, Ltry, lowLhood, um, size, plot=False ) [source]
Find the edge of the likelihood where logL equals LowLhood.

Parameters

  • problem : Problem
         the problem
  • ptry : array-like
         parameters with likelihood outside lowLhood region
  • fitIndex : array-like
         indices of parameters that need fitting
  • Lhood : float
         last likelihood before going outside
  • Ltry : float
         likelihood outside (at ptry)
  • lowLhood : float
         lower limit in logLikelihood
  • um : UnitMovements (see below)
         of this run
  • size : float
         present size value

Returns

  • pedge : array-like
         parameter values at the edge of lowLhood
  • restep : float
         part of the step outside lowLhood area.

quadInterpol( x, y, lowL, plot=False ) [source]
Quadratic interpolation of a function defined by 3 point (x,y) at level ylow.

Parameters

  • x : array of 3 floats
         x-values
  • y : array of 3 floats
         y-values
  • ylow : float
         find xlow at ylow
Methods inherited from Engine