Skip to contents

This function removes points outside of a elliptical region

Usage

trim_shape(data, r = 0.6)

Arguments

data

A matrix or data frame with three columns (x, y, class).

r

Numeric; Correlation defining the shape, between -1, 1; default 0.6

Value

A data frame with three+n_vars columns, like:

x

Random uniform coordinate

y

Random uniform coordinate

class

Binary class label ("Above" or "Below")

Examples


coords <- matrix(c(0.2, 0.3,
                   0.4, 0.5,
                   0.6, 0.7), ncol = 2, byrow = TRUE)

df <- create_data(coord = coords, n_samples = 500, seed = 717)

df <- trim_shape(df)
plot(df$x, df$y, col=ifelse(df$class == "Above", "red", "yellow"))