Learn R Programming

hypervolume (version 2.0.12)

hypervolume_inclusion_test: Inclusion test

Description

Determines if a set of points are within a hypervolume. Can operate using a 'fast' algorithm which determines whether at least one random point of the hypervolume is within a critical distance of the test point. This algorithm is very efficient but leads to noisy and error-prone results when the point density slow. A warning is generated if this algorithm is used.

The function can also operate using an 'accurate' algorithm which estimates the probability density at the test point, and rejects it if it is below the requested threshold value. This is very slow but guarantees good results.

Usage

hypervolume_inclusion_test(hv, points, reduction.factor = 1, fast.or.accurate =
                 "fast", fast.method.distance.factor = 1,
                 accurate.method.threshold =
                 quantile(hv@ValueAtRandomPoints,
                 0.5), verbose = TRUE, ...)

Arguments

hv

n-dimensional hypervolume to compare against

points

Candidate points. A m x n matrix or dataframe, where m is the number of candidate points and n is the number of dimensions.

reduction.factor

A number in (0,1] that represents the fraction of random points sampled from the hypervolume for the stochastic inclusion test. Larger values are more accurate but computationally slower.

fast.or.accurate

If 'fast', uses the critical distance test. If 'accurate', uses a probability density estimate.

fast.method.distance.factor

Numeric value; multiplicative factor applied to the critical distance for all inclusion tests (see below). Used only when fast.or.accurate='fast'.

accurate.method.threshold

Numeric value; threshold probability value below which the point is determined to be out of the hypervolume. Used only when fast.or.accurate='accurate'.

verbose

Logical value; print diagnostic output if true.

...

Additional arguments to be passed to either hypervolume_estimate_probability or hypervolume_inclusion_test.

Value

A m x 1 logical vector indicating whether each candidate point is in the hypervolume.

Examples

Run this code
# NOT RUN {
# construct a hypervolume of points in the unit square [0,1] x [0,1]
data = data.frame(x=runif(100,min=0,max=1), y=runif(100,min=0,max=1))
hv = hypervolume_gaussian(data)

# test if (0.5,0.5) and (-1,1) are in - should return TRUE FALSE
hypervolume_inclusion_test(hv, points=data.frame(x=c(0.5,-1),y=c(0.5,-1)))
# }

Run the code above in your browser using DataLab