points_inside_convex_hull {GeomArchetypal} | R Documentation |
Computes the Percentage of Points that Lie Inside the Convex Hull which is Created by a Set of Vectors
Description
Given a set of k d-dimensional vectors which creates a Convex Hull (CH) we want to find the percentage of the n points of the n x d data frame df that lie inside that CH.
Usage
points_inside_convex_hull(df, dp)
Arguments
df |
The n x d data frame of all available data points |
dp |
The k x d data frame of the given set of points that creates the Convex Hull |
Details
In order for a really Convex Hull creation it must hold that: k >= d + 1, otherwise the problem is not well stated.
Value
A numeric output with percentage in two decimal digits
Note
Keep in mind that working with dimension greater than 6 will practical lead to extreme time executions. It highly suggested to work only for spaces with d<=6.
Author(s)
Demetris T. Christopoulos
Examples
# Load package
library(GeomArchetypal)
# Create random data:
set.seed(20140519)
df=matrix(runif(90) , nrow = 30, ncol=3)
colnames(df)=c("x","y","z")
# Grid Archetypal:
gaa=grid_archetypal(df, niter = 70, verbose = FALSE)
pc1=points_inside_convex_hull(df,gaa$grid)
print(pc1)
# [1] 100
# Closer Grid Archetypal:
cga=closer_grid_archetypal(df, niter = 70, verbose = FALSE)
pc2=points_inside_convex_hull(df,cga$aa$BY)
print(pc2)
# [1] 59
[Package GeomArchetypal version 1.0.2 Index]