dim
dimensional Halton sequence.R/mcmc-functions.R
mcmc_sample_halton_sequence.Rd
Warning: The sequence elements take values only between 0 and 1. Care must be taken to appropriately transform the domain of a function if it differs from the unit cube before evaluating integrals using Halton samples. It is also important to remember that quasi-random numbers without randomization are not a replacement for pseudo-random numbers in every context. Quasi random numbers are completely deterministic and typically have significant negative autocorrelation unless randomization is used.
mcmc_sample_halton_sequence( dim, num_results = NULL, sequence_indices = NULL, dtype = tf$float32, randomized = TRUE, seed = NULL, name = NULL )
dim | Positive |
---|---|
num_results | (Optional) Positive scalar |
sequence_indices | (Optional) |
dtype | (Optional) The dtype of the sample. One of: |
randomized | (Optional) bool indicating whether to produce a randomized
Halton sequence. If TRUE, applies the randomization described in
Owen (2017). Default value: |
seed | (Optional) integer to seed the random number generator. Only
used if |
name | (Optional) string describing ops managed by this function. If not supplied the name of this function is used. Default value: "sample_halton_sequence". |
halton_elements Elements of the Halton sequence. Tensor
of supplied dtype
and shape
[num_results, dim]
if num_results
was specified or shape
[s, dim]
where s is the size of sequence_indices
if sequence_indices
were specified.
Computes the members of the low discrepancy Halton sequence in dimension
dim
. The dim
-dimensional sequence takes values in the unit hypercube in
dim
dimensions. Currently, only dimensions up to 1000 are supported. The
prime base for the k-th axes is the k-th prime starting from 2. For example,
if dim
= 3, then the bases will be [2, 3, 5]
respectively and the first
element of the non-randomized sequence will be: [0.5, 0.333, 0.2]
. For a more
complete description of the Halton sequences see
here. For low discrepancy
sequences and their applications see
here.
If randomized
is true, this function produces a scrambled version of the
Halton sequence introduced by Owen (2017). For the advantages of
randomization of low discrepancy sequences see
here.
The number of samples produced is controlled by the num_results
and
sequence_indices
parameters. The user must supply either num_results
or
sequence_indices
but not both.
The former is the number of samples to produce starting from the first
element. If sequence_indices
is given instead, the specified elements of
the sequence are generated. For example, sequence_indices=tf$range(10) is
equivalent to specifying n=10.
For an example how to use see mcmc_sample_chain()
.
Other mcmc_functions:
mcmc_effective_sample_size()
,
mcmc_potential_scale_reduction()
,
mcmc_sample_annealed_importance_chain()
,
mcmc_sample_chain()