PhantomSampler = class PhantomSampler(NestedSampler) |
|
PhantomSampler(xdata=None, model=None, ydata=None, weights=None, accuracy=None,
problem=None, distribution=None, limits=None, keep=None, ensemble=100,
seed=80409, rate=1.0, engines=None, maxsize=None, threads=False,
verbose=1, step=4)
PhantomSampler is a version of NestedSampler that removes step walkers from
the list. It uses a selection of the intermediate (phantom) positions which
are created inside the engines as valid walker points.
These phantoms are added to the walkerlist, until it fills the
ensemble to its initial value.
Each iteration a percentage of the walkers is used to update the evidence
and are subsequently transferred to the list of posterior samples.
In principle it speeds up the calculations by a factor step, of course it
pays in exploratory power and precision.
Attributes
----------
step : int (< 10)
percentage of the walkers to replace
Attributes from NestedSampler
-----------------------------
xdata, model, ydata, weights, problem,
distribution, ensemble, discard, rng, seed,
rate, maxsize, minimumIterations, end, verbose,
walkers, samples, engines,
initialEngine
Author Do Kester. |
|
- Method resolution order:
- PhantomSampler
- NestedSampler
- builtins.object
Constructor:
- PhantomSampler( xdata=None, model=None, ydata=None, weights=None, accuracy=None,
problem=None, distribution=None, limits=None, keep=None, ensemble=100,
seed=80409, rate=1.0, engines=None, maxsize=None, threads=False,
verbose=1, step=4)
- Create a new class, providing inputs and model.
Either (model,xdata,ydata) needs to be provided or a completely filled
problem.
Parameters
----------
step : int
percentage of walkers to use
Parameters from NestedSampler
-----------------------------
xdata : array_like
array of independent input values
model : Model
the model function to be fitted
the model needs priors for the parameters and (maybe) limits
ydata : array_like
array of dependent (to be fitted) data
weights : array_like (None)
weights pertaining to ydata
accuracy : float or array_like
accuracy scale for the datapoints
all the same or one for each data point
problem : None or string or Problem
Defines the kind of problem to be solved.
None same as "classic"
"classic" ClassicProblem
"errors" ErrorsInXandYProblem
"multiple" MultipleOutputProblem
Problem Externally defined Problem. When Problem has been provided,
xdata, model, weights and ydata are not used.
keep : None or dict of {int:float}
None of the model parameters are kept fixed.
Dictionary of indices (int) to be kept at a fixed value (float).
Hyperparameters follow model parameters.
The values will override those at initialization.
They are used in this instantiation, unless overwritten at the call to sample()
distribution : None or String or ErrorDistribution
Defines the ErrorDistribution to be used
When the hyperpar(s) are not to be kept fixed, they need `Prior` and maybe limits.
None same as "gauss"
"gauss" GaussErrorDistribution with (fixed) scale equal to 1.0
"laplace" LaplaceErrorDistribution with 1 hyperpar scale
"poisson" PoissonErrorDistribution no hyperpar
"cauchy" CauchyErrorDstribution with 1 hyperpar scale
"uniform" UniformErrorDistribution with 1 hyperpar scale
"exponential" ExponentialErrorDistribution with 2 hyperpar (scale, power)
"bernoulli" BernoulliErrorDistribution no hyperpar
ErrorDistribution Externally defined ErrorDistribution
limits : None or [low,high] or [[low],[high]]
None no limits implying fixed hyperparameters of the distribution
low low limit on hyperpars
high high limit on hyperpars
When limits are set the hyperpars are not fixed.
ensemble : int
number of walkers
seed : int
seed of random number generator
rate : float
speed of exploration
engines : None or (list of) string or (list of) Engine
to randomly move the walkers around, within the likelihood bound.
None use a Problem defined selection of engines
"galilean" GalileanEngine move forward and mirror on edges
"chord" ChordEngine select random point on random line
"gibbs" GibbsEngine move one parameter at a time
"step" StepEngine move all parameters in arbitrary direction
For Dynamic models only:
"birth" BirthEngine increase the parameter list of a walker by one
"death" DeathEngine decrease the parameter list of a walker by one
For Modifiable models only:
"struct" StructureEngine change the (internal) structure.
Engine an externally defined (list of) Engine
maxsize : None or int
maximum size of the resulting sample list (None : no limit)
threads : bool (False)
Use Threads to distribute the diffusion of discarded samples over the available cores.
verbose : int (1)
0 silent
1 basic information
2 more about every 100th iteration
3 more about every iteration
>4 for debugging
Methods defined here:
- initSample( ensemble=None, keep=None )
- updateWalkers( explorer, worst )
- Update the walkerlist while appending the new (phantom) walkers to the list
Parameters
----------
explorer : Explorer
Explorer object
worst : int
number of walkers to update
Methods inherited from NestedSampler:
- calculateUnitRange()
- copyWalker( worst )
- doIterPlot( plot )
- doLastPlot( plot )
- getMaxIter()
- initReport( keep=None, plot=False )
- initWalkers( ensemble, allpars, fitIndex, startdict=None )
- iterReport( kw, tail, plot=False )
- lastReport( kw, plot=False )
- makeFitlist( keep=None )
- optionalRestart()
- optionalSave()
- plotData( plot=0)
- plotResult( walker, iter, plot=0)
- report()
- sample( keep=None, plot=False )
- setEngines( engines=None, enginedict=None )
- setErrorDistribution( name=None, limits=None, scale=1.0, power=2.0)
- setProblem( name, model=None, xdata=None, ydata=None, weights=None, accuracy=None )
- sortLogL( walkers )
- updateEvidence( worst )
- walkerLogL( w )
|
|