SampleList

 
SampleList = class SampleList(builtins.list)
    SampleList(model, nsamples, parameters=None, fitIndex=None, ndata=1)
 
SampleList is a list of Samples, see Sample
 
SampleList is the main result of the NestedSampler. It contains all
information to calculate averages, medians, modi or maximum likihood solutions
of the parameters, or of any function of the parameters; in particular of the
Model.
 
To make averages one has to take into account the weights. Each Sample has a weight
and all weights sum to 1.0. So the average of any function, f, of the parameters p is
 
    E( f(p) ) = ∑ w_k f( p_k )
 
where the sum is over all samples k.
 
A large set of utility functions is provided to extract the information from the
SampleList.
 
 
Attributes
----------
parameters : numpy.array (read-only)
    The average over the parameters. Not for dynamic models.
stdevs, standardDeviations : numpy.array (read-only)
    The standard deviations for the parameters. Not for dynamic models
scale : float
    The average of the noise scale
stdevScale : float
    the standard deviation of the scale.
 
logZ : float (read-only)
    Natural log of evidence
evidence : float (read-only)
    log10( Z ). Evidence * 10 is interpretable as dB.
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 ).
 
maxLikelihoodIndex : int (read-only)
    The index at which the max likelihood can be found: always the last in the list
maxLikelihoodParameters : numpy.array (read-only)
    The maximum likelihood parameters at the maxLikelihoodIndex.
maxLikelihoodScale : float (read-only)
    The maximum likelihood noise scale at the maxLikelihoodIndex.
medianIndex : int (read-only)
    The index at which the median can be found: the middle of the cumulative weights.
    It is calculated once and then kept.
medianParameters : numpy.array (read-only)
    The median of the parameters at the medianIndex
medianScale : float (read-only)
    The median of the noise scale at the medianIndex
modusIndex : int (read-only)
    The index at which the modus can be found: the largest weight
    It is calculated once and then kept.
modusParameters : numpy.array (read-only)
    The modus of the parameters at the modusIndex
modusScale : float (read-only)
    The modus of the noise scale at the modusIndex.
 
normalized : bool
    True when the weights are normalized to SUM( weights ) = 1
 
 
Author       Do Kester
 
 
Method resolution order:
SampleList
builtins.list
builtins.object

Constructor:
SampleList( model, nsamples, parameters=None, fitIndex=None, ndata=1)
Constructor.
 
Parameters
----------
nsamples : int
    number of samples created.
model : Model
    to be used in the samples
parameters : array_like
    list of model parameters
fitIndex : array of int
    indicating which parameters need fitting
ndata : int
    length of the data vector; to be used in stdev calculations
Methods defined here:
add( sample )
Add a Sample to the list
 
Parameters
----------
sample : Sample
    the sample to be added
addSamples( model, nSamples, parameters, fitIndex=None )
average( xdata )
Return the (weighted) average result of the model(s) over the samples.
 
Parameters
----------
xdata : array_like
    the input
averstd( name )
Return the average and the stddevs of the named attribute from Sample
 
Parameters
----------
name : str
    name of an attribute from Sample
copy( src, des )
Copy one item of the list onto another.
 
Parameters
----------
src : int
    the source item
des : int
    the destination item
getGeneration()
Return the generation number pertaining to the evolution.
getHypars()
Return the hyper parameters
getLogLikelihoodEvolution()
Return the evolution of the log( Likelihood ).
getLogWeightEvolution()
Return the evolution of the log( weight ).
 
The weights itself sum up to 1.
See #getWeightEvolution( ).
getLowLogL()
Return the lowest value of logL in the samplelist, plus its index.
getMaximumNumberOfParameters()
Return the maximum number of parameters (for Dynamic Models)
getMedianIndex()
Return the index at which the median can be found.
getNuisance()
Return the average of the nuisance parameters (if present)
getNumberOfParametersEvolution()
Return the evolution of the number of parameters.
getParAndWgtEvolution()
Return the evolution of parameters and weights.
 
In case of dynamic models the number of parameters may vary.
They are zero-padded. Use `getNumberOfParametersEvolution`
to get the actual number.
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
getParameters()
Calculate the average of the parameters and the standard deviations.
 
Return
------
    The average values of the parameters.
Raises
------
    ValueError when using Dynamic Models
getParentEvolution()
Return the evolution of the parentage.
getScaleEvolution()
Return the evolution of the scale.
getStartEvolution()
Return the evolution of the start generation.
getWeightEvolution()
Return the evolution of the weight.
 
The weights sum to 1.
logPlus( x, y )
Return  log( exp(x) + exp(y) )
monteCarloError( xdata )
Calculates 1-\sigma-confidence regions on the model given some inputs.
 
The model is run with the input for the parameters in each of the
samples. Appropiately weighted standard deviations are calculated
and returned at each input value.
 
Parameters
----------
xdata : array_like
   the input vectors.
 
Returns
-------
error : array_like
    standard deviations at each input point
normalize()
Normalize the samplelist.
make Sum( weight ) = 1
sample( k, sample=None )
Set or return the k-th sample from the list.
 
Parameters
----------
k : int
    the index of the sample
sample : Sample
    if present, set the kth sample with sample
weed( maxsize=None )
Weed superfluous samples.
 
If MaxSamples has been set, it is checked whether the size of the
SampleList exceeds the maximum. If so the Sample with the smallest
log( Weight ) is removed.
weed( ) is called recursively until the size has the required length.

Methods inherited from builtins.list:
Overloaded operators and aliases
Other methods Overloaded operators and aliases