rp_sparse {spareg} | R Documentation |
Sparse random projection 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 (Achlioptas 2003).
Usage
rp_sparse(..., 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
|
Details
The sparse matrix used in (Achlioptas 2003) with entries equal to
\Psi_{ij} = \pm 1/\sqrt{\psi}
with probability \psi/2
and zero otherwise
for \psi\in (0,1]
. Default is psi = 1
.
Arguments related to the random projection procedure can
be passed to the rp_gaussian()
function through ...
, and
will be saved as attributes of the 'randomprojection'
object.
The following attributes are relevant for spar and spar.cv:
-
mslow
: integer giving the minimum dimension to which the predictors should be projected; defaults to\log(p)
. -
msup
: integer giving the maximum dimension to which the predictors should be projected; defaults ton/2
.
Value
object of class 'randomprojection'
which is a list with
elements name,
generate_fun
, update_fun
, control
References
Achlioptas D (2003). “Database-Friendly Random Projections: Johnson-Lindenstrauss with Binary Coins.” Journal of Computer and System Sciences, 66(4), 671-687. ISSN 0022-0000, doi:10.1016/S0022-0000(03)00025-4, Special Issue on PODS 2001.
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_sparse(control = list(psi = 1/3)))