Learn R Programming

hypervolume (version 1.4.1)

expectation_convex: Convex expectation

Description

Creates a hypervolume with geometry of the convex polytope (hull) minimally enclosing a set of points

Usage

expectation_convex(input, 
  npoints_inhull = NULL, npoints_onhull = NULL,
  check_memory = TRUE, userandom = FALSE)

Arguments

input

A data frame or hypervolume object whose data are enclosed by the output hypervolume.

npoints_inhull

Number of random points in the output hypervolume. If NULL and input is of class Hypervolume, defaults to a value that matches the point density of the input hypervolume; if NULL and input is a data frame, defaults to 1000*10^sqrt(n), where n is the dimensionality.

npoints_onhull

Number of data points to sample from the input to define the convex polytope. Samples are weighted by their Euclidean distance from the centroid of the input. If NULL, defaults to 10^sqrt(n).

check_memory

If TRUE, prints estimated memory usage and convex polytope size and exits. Otherwise contines the algorithm. Memory usage can be very high in high dimensions.

userandom

If input is a hypervolume and userandom is TRUE, the output hypervolume will enclose the uniformly random points defining the hypervolume; otherwise, it will enclose the data points used to build the hypervolume. If input is a data frame, this argument is ignored.

Value

A Hypervolume object containing a uniformly random set of points sampled from the convex polytope enclosing the input data.

Details

The computational complexity of convex polytope algorithms is very high. Running in n>5 dimensions may crash most desktop computers due to high memory requirements. Even if sufficient memory is available, rejection sampling becomes exponentially inefficient with dimensionality, resulting in long runtimes.

Examples

Run this code
# NOT RUN {
# NOTE: uncomment next lines to try example (not run to pass CRAN runtime checks)

data(iris)

#hv1 = hypervolume(subset(iris, Species=="setosa")[,1:4],bandwidth=0.2)

#ec <- expectation_convex(hv1, userandom=F, check_memory=FALSE)
#plot(hypervolume_join(hv1, ec))

# }

Run the code above in your browser using DataLab