Increasing/decreasing

The following constraints may be used to impose sequential constraints when sampling a collection of uncertain values element-wise.

StrictlyIncreasing

UncertainData.SamplingConstraints.StrictlyIncreasingType
StrictlyIncreasing(algorithm::OrderedSamplingAlgorithm; 
    n::Int = 50000, lq = 0.05, uq = 0.95)

Sampling scheme indicating element-wise sampling such that the resulting values are strictly increasing in magnitude.

Increasing sequential sampling is only guaranteed when distributions have finite support. Therefore, distributions are element-wise truncated to the lower and upper quantiles lq and uq. For each distribution, this is done by drawing n values from it, then finding the quantiles for that sample, and finally truncating the distribution to the empirical quantile range.

algorithm is an instance of some OrderedSamplingAlgorithm (e.g. StartToEnd). n is the number of samples to draw when computing quantiles.

Typically used when there are known, physical constraints on the measurements. For example, geochemical measurements of sediments at different depths of a sediment core are taken at physically separate depths in the core. Thus, the order of the indices cannot be flipped, and must be strictly decreasing/increasing.

See also: StartToEnd

source

StrictlyDecreasing

UncertainData.SamplingConstraints.StrictlyDecreasingType
StrictlyIncreasing(algorithm::OrderedSamplingAlgorithm; n::Int = 50000)

Sampling scheme indicating element-wise sampling such that the resulting values are strictly decreasing in magnitude.

Decreasing sequential sampling is only guaranteed when distributions have finite support. Therefore, distributions are element-wise truncated to the lower and upper quantiles lq and uq. For each distribution, this is done by drawing n values from it, then finding the quantiles for that sample, and finally truncating the distribution to the empirical quantile range.

algorithm is an instance of some OrderedSamplingAlgorithm (e.g. StartToEnd). n is the number of samples to draw when computing quantiles.

Typically used when there are known, physical constraints on the measurements. For example, geochemical measurements of sediments at different depths of a sediment core are taken at physically separate depths in the core. Thus, the order of the indices cannot be flipped, and must be strictly decreasing/increasing.

See also: StartToEnd

source

Existence of sequences

sequence_exists will check whether a valid sequence through your collection of uncertain values exists, so that you can know beforehand whether a particular sequential sampling constraint is possible to apply to your data.

UncertainData.SamplingConstraints.sequence_existsFunction
sequence_exists(x, c::SequentialSamplingConstraint)

Does a point-by-point sequence through the uncertain dataset x exist that satisfies the criteria c?

If x is an UncertainIndexValueDataset, then check for a sequence through the indices only.

Before the check is performed, the distributions in x are truncated to the quantiles provided by c to ensure they have finite supports.

Example

# Create a set of time indices 
# We construct this is such a way that we *know* an increasing sequence exists. 
t = [UncertainValue(Normal, i, 2) for i in 1:N];
sequence_exists(t, StrictlyIncreasing(StartToEnd()))
source