rp_cw: Sparse embedding matrix

rp_cwR Documentation

Sparse embedding matrix

Description

Creates an object class 'randomprojection' using arguments passed by user which in turn can be employed to generate a sparse embedding matrix as in \insertCiteClarkson2013LowRankApproxspareg.

Usage

rp_cw(..., control = list())

Arguments

...

includes arguments which can be passed as attributes to the random projection matrix

control

list of arguments to be used in functions generate_fun, update_fun, update_rpm_w_data

Details

The entries of the matrix are generated based on \insertCiteClarkson2013LowRankApproxspareg. This matrix is constructed as \Phi=BD\in \mathbb{R}^{m\times p}, where B is a (p\times p) binary matrix, where for each column j an index is uniformly sampled from \{1,\ldots,m\} and the corresponding entry is set to one, and D is a (p\times p) diagonal matrix, with entries d_j \sim \text{Unif}(\{-1, 1\}). If specified as rp_cw(data = TRUE), the random elements on the diagonal are replaced by the ridge coefficients with a small penalty, as introduced in \insertCiteparzer2024glmsspareg.

Value

object of class 'randomprojection' which is a list with elements name, generate_fun, update_fun, control

References

\insertRef

Clarkson2013LowRankApproxspareg

\insertRef

parzer2024glmsspareg.

Examples

example_data <- simulate_spareg_data(n = 200, p = 2000, ntest = 100)
spar_res <- spar(example_data$x, example_data$y, xval = example_data$xtest,
  yval = example_data$ytest, nummods=c(5, 10, 15, 20, 25, 30),
  rp = rp_cw(data = TRUE))


spareg documentation built on Aug. 8, 2025, 6:46 p.m.