auto_gpower: Find GPower rho for proportion of sparsity

Description Usage Arguments Examples

View source: R/auto_gpower.R

Description

Using binary search find a value of rho for which the weights matrix of gpower has a proportion of sparsity close to prop_sparse. It forwards the other settings to the gpower function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
auto_gpower(
  data,
  k,
  prop_sparse,
  accuracy = 2,
  reg = c("l0", "l1"),
  center = c(TRUE, FALSE),
  block = c(TRUE, FALSE),
  mu = 1,
  iter_max = 1000,
  epsilon = 1e-04
)

Arguments

data

Input matrix of size (p x n) with p < n.

k

Number of components, 0 < k < p.

prop_sparse

The percentage of the total values of the weights matrix which is equal to zero.

accuracy

The amount of digits to which to round prop_sparse and the sparsity of the weights.

reg

regularisation type to use in the optimization. Either 'l0' or 'l1'. The default is 'l1' since it performed best in experiments.

center

Centers the data. Either TRUE or FALSE. The default is TRUE.

block

Optimization method. If FALSE, the components are calculated individually. If TRUE, all components are calculated at the same time. The default is FALSE.

mu

Mean to be applied to each component in the block. Either a vector of float of size k or a float which will be repeated k times. Only used if block is TRUE. The default is 1.

iter_max

Maximum iterations when adjusting components with gradient descent. The default is 1000.

epsilon

Epsilon of the gradient descent stopping function. The default is 1e-4.

Examples

1
2
3
4
5
6
7
8
9
set.seed(360)
p <- 20
n <- 50
k <- 5
data <- matrix(stats::rnorm(p * n), nrow = p, ncol = n)
prop_sparse <- 0.1
mu <- 1

auto_gpower(data, k, prop_sparse, reg = 'l1', center = TRUE, block = FALSE)

plofknaapje/gpowerpca documentation built on July 27, 2021, 4:17 a.m.