name (str) – name attributed to the Voronoi tessellation, for display and storing
purposes
spatial_dimensions (int) – number of dimensions of the desired Voronoi tessellation, e.g. 1D,
2D, or 3D.
vmin (Union[Number, np.ndarray]) – minimum/maximum value bounding each dimension
vmax (Union[Number, np.ndarray]) – minimum/maximum value bounding each dimension
perturb_std (Union[Number, np.ndarray]) – standard deviation of the Gaussians used to randomly perturb the Voronoi
sites in each dimension.
n_dimensions (Number, optional) – number of dimensions. None (default) results in a trans-dimensional
discretization, with the dimensionality of the parameter space allowed
to vary in the range n_dimensions_min-n_dimensions_max
n_dimensions_min (Number, optional) – minimum and maximum number of dimensions, by default 1 and 10. These
parameters are ignored if n_dimensions is not None, i.e. if the
discretization is not trans-dimensional
n_dimensions_max (Number, optional) – minimum and maximum number of dimensions, by default 1 and 10. These
parameters are ignored if n_dimensions is not None, i.e. if the
discretization is not trans-dimensional
n_dimensions_init_range (Number, optional) –
percentage of the range n_dimensions_min` - n_dimensions_max used to
initialize the number of dimensions (0.3. by default). For example, if
n_dimensions_min = 1, n_dimensions_max = 10, and
n_dimensions_init_range = 0.5,
the maximum number of dimensions at the initialization is
parameters (List[Prior], optional) – a list of free parameters, by default None
birth_from ({"prior", "neighbour"}, optional) – whether to initialize the free parameters associated with the newborn
Voronoi cell by randomly drawing from their prior or by perturbing the
value found in the nearest Voronoi cell (default).
the list of perturbation functions allowed in the parameter space linked to
the Voronoi discretization. Each function takes in a state (see State)
and returns a new state along with the corresponding partial acceptance
probability,
a list of perturbation weights, corresponding to each of the
perturbation_funcs() that determines the probability of each of them
to be chosen during each step
The weights are not normalized and have the following default values:
creates a new Voronoi cell, initializes all free parameters
associated with it, and returns the pertubed state along with the
log of the corresponding partial acceptance probability,
where \(k\) denotes the number of Voronoi cells, each entry of the
vector \({\bf c}\) corresponds to the position of a Voronoi site,
and each \(i\)th free parameter \({\bf v}\) has the same
dimensionality as \({\bf c}\).
Following [1], \(p({\bf c} \mid k) = \frac{k! \left(N - k \right)!}{N!}\). If we then
assume that \(p(k) = \frac{1}{\Delta k}\), where \(\Delta k = k_{max} - k_{min}\),
the prior ratio reads
where \(p(v_i^{k+1})\) denotes the prior probability of the newly
born \(i\)th parameter, which may be dependent on \({\bf c}\).
The proposal ratio reads
where \(q_{v_i}^{k+1}\) denotes the proposal probability for the
newly born \(i\)th parameter in the new dimension. It is easy to
show that, in the case of a birth from neighbor [1] or a birth from
prior [2] (see birth_from), \(\lvert \mathbf{J} \rvert = 1\)
and \(\alpha_{p} = \frac{p({\bf m'})}{p({\bf m})} \frac{q({\bf m} \mid {\bf m'})}{q({\bf m'} \mid {\bf m})}\).
It follows that
In the case of a birth from neighbor, \(q_{v_i}^{k+1} =
\frac{1}{\theta \sqrt{2 \pi}} \exp \lbrace -\frac{\left( v_i^{k+1} - v_i \right)^2}{2\theta^2} \rbrace\),
where the newly born value, \(v_i^{k+1}\), is generated by perturbing
the original value, \(v_i\), of the \(i\)th parameter. This is
achieved through a random deviate from the normal distribution
\(\mathcal{N}(v_i, \theta)\), with \(\theta\) denoting the
standard deviation of the Gaussian used to carry out the perturbation
(see, for example, bayesbay.prior.UniformPrior.perturb_std) .
The partial acceptance probability is then computed numerically.
It is straightforward to show that this equals the reciprocal of
the partial acceptance probability obtained in the case of a birth
perturbation (see birth()), i.e.,
get the standard deviation of the Gaussian used to perturb
the parameter at birth, which may be dependent on the position in the
discretization domain
Parameters:
position (Union[Number, np.ndarray], optional) – the position in the discretization domain at which the standard
deviation of the Gaussian used to perturb the parameter at birth
is returned. Default is None
Returns:
standard deviation of the Gaussian used to perturb the parameter at birth,
possibly at the specified position
BayesBay implements the grid trick, which calculates the prior
probability of a Voronoi discretization through the combinatorial
formula \({N \choose k}^{-1}\), with k denoting the number of
Voronoi sites and N the number of possible positions allowed for the
sites [3].
initialize_func (Callable[["Prior", np.ndarray], np.ndarray]) – The function to use for initialization. This function should take a
Prior instance and optionally an array of positions as input
arguments, and produce an array of values as output.
Examples
defmy_init(param:bb.prior.Prior,position:np.ndarray)->np.ndarray:print("This is my custom init!")returnnp.ones(len(position))my_param.set_custom_initialize(my_init)