cobra_validate: Perform validation to select regularization parameter

Description Usage Arguments Examples

View source: R/cobra_validate.r

Description

cobra_validate performs an MM algorithm wrapper to do parameter selection.

Usage

1
2
3
cobra_validate(X, E_row, E_col, w_row, w_col, gamma, Lambda_row = matrix(0, n,
  nrow(E_row)), Lambda_col = matrix(0, p, nrow(E_col)), fraction = 0.1,
  max_iter = 100, tol = 0.001, max_iter_inner = 1000, tol_inner = 1e-04)

Arguments

X

Data matrix

E_row

Edge-incidence matrix for row graph

E_col

Edge-incidence matrix for column graph

w_row

Vector of weights for row graph

w_col

Vector of weights for column graph

gamma

Regularization parameter for shrinkage

Lambda_row

Initial guess of row Langrage multipliers

Lambda_col

Initial guess of column Langrage multipliers

fraction

Fraction of entries for hold out

max_iter

Maximum number of iterations

tol

Stopping criterion

max_iter_inner

Maximum number of inner cobra iterations

tol_inner

Stopping criterion for inner cobra loop

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## Create bicluster path
## Example: Lung
X <- lung
X <- X - mean(X)
X <- X/norm(X,'f')

## Create annotation for heatmap
types <- colnames(lung)
ty <- as.numeric(factor(types))
cols <- rainbow(4)
YlGnBu5 <- c('#ffffd9','#c7e9b4','#41b6c4','#225ea8','#081d58')
hmcols <- colorRampPalette(YlGnBu5)(256)

## Construct weights and edge-incidence matrices
phi <- 0.5; k <- 5
wts <- gkn_weights(X,phi=phi,k_row=k,k_col=k)
w_row <- wts$w_row
w_col <- wts$w_col
E_row <- wts$E_row
E_col <- wts$E_col

## Connected Components of Row and Column Graphs
wts$nRowComp
wts$nColComp

#### Initialize path parameters and structures
nGamma <- 7
gammaSeq <- 10**seq(0,1,length.out=nGamma)

## Generate solution path
sol <- cobra_validate(X,E_row,E_col,w_row,w_col,gammaSeq,fraction=0.01)

## Plot validation error
verr <- sol$validation_error
plot(verr)

## Heatmap of data smoothed at the model selected to minimize validation error
ix <- which.min(verr)
groups_row <- sol$groups_row[[ix]]
groups_col <- sol$groups_col[[ix]]
M <- biclust_smooth(X,groups_row,groups_col)
heatmap(M,col=hmcols,labRow=NA,labCol=NA,ColSideCol=cols[ty])

cvxbiclustr documentation built on May 2, 2019, 9:34 a.m.