Description Usage Arguments Author(s) Examples
View source: R/sparseDecomboot.R
Decomposes a matrix into sparse eigenevectors to maximize explained variance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | sparseDecomboot(
inmatrix,
inmask = NULL,
sparseness = 0.01,
nvecs = 50,
its = 5,
cthresh = 250,
z = 0,
smooth = 0,
initializationList = list(),
mycoption = 0,
nboot = 10,
nsamp = 0.9,
robust = 0,
doseg = TRUE
)
|
inmatrix |
n by p input images , subjects or time points by row , spatial variable lies along columns |
inmask |
optional antsImage mask |
sparseness |
lower values equal more sparse |
nvecs |
number of vectors |
its |
number of iterations |
cthresh |
cluster threshold |
z |
u penalty, experimental |
smooth |
smoothness eg 0.5 |
initializationList |
see initializeEigenanatomy |
mycoption |
0, 1 or 2 all produce different output 0 is combination of 1 (spatial orthogonality) and 2 (subject space orthogonality) |
nboot |
boostrap integer e.g. 10 equals 10 boostraps |
nsamp |
value less than or equal to 1, e.g. 0.9 means 90 percent of data will be used in each boostrap resampling |
robust |
boolean |
doseg |
orthogonalize bootstrap results |
Avants BB
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 | mat<-replicate(100, rnorm(20))
mydecom<-sparseDecomboot( mat, nboot=5, nsamp=0.9, nvecs=2 )
## Not run:
# for prediction
if ( usePkg("randomForest") & usePkg("spls") ) {
data(lymphoma)
training<-sample( rep(c(TRUE,FALSE),31) )
sp<-0.001 ; myz<-0 ; nv<-5
ldd<-sparseDecomboot( lymphoma$x[training,], nvecs=nv ,
sparseness=( sp ), mycoption=1, z=myz , nsamp=0.9, nboot=50 ) # NMF style
outmat<-as.matrix(ldd$eigenanatomyimages )
# outmat<-t(ldd$cca1outAuto)
traindf<-data.frame( lclass=as.factor(lymphoma$y[ training ]),
eig = lymphoma$x[training,] %*% t(outmat) )
testdf<-data.frame( lclass=as.factor(lymphoma$y[ !training ]),
eig = lymphoma$x[!training,] %*% t(outmat) )
myrf<-randomForest( lclass ~ . , data=traindf )
predlymp<-predict(myrf, newdata=testdf)
print(paste('N-errors:',sum(abs( testdf$lclass != predlymp ) ),
'non-zero ',sum(abs( outmat ) > 0 ) ) )
for ( i in 1:nv )
print(paste(' non-zero ',i,' is: ',sum(abs( outmat[i,] ) > 0 ) ) )
}
## End(Not run) # end dontrun
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.