Selects endmember candidates by projecting the data onto randomly generated vectors and identifying extreme points in the projected space.

random_projections(data, p, iter_max = 2 * p)

Arguments

data

A numeric matrix where each row represents a data point and each column represents a coordinate/dimension.

p

Number of endmembers to select.

iter_max

Maximum number of projections to try, to avoid edge cases where all (or many) projections result in same extreme points.

Value

A list containing:

indices

An integer vector of length p containing the row indices of the selected endmember candidates from the input data matrix.

Examples

# Create sample data
set.seed(123)
data("demo_data")

# Select 4 endmembers using random projections
result <- random_projections(demo_data, p=4)
print(result$indices)
#> [1] 9 3 7 2