Description Usage Arguments Value See Also Examples
View source: R/statismoGaussProcess.r
expands a models variability by adding a Gaussian kernel function to the empiric covariance matrix and builds a low-rank approximation of the resulting PCA
1 2 | statismoGPmodel(model, kernel = GaussianKernel(50, 10), ncomp = 10,
nystroem = 500)
|
model |
shape model of class |
kernel |
an object of class matrixKernel |
ncomp |
integer: number of PCs to approximate |
nystroem |
number of samples to compute Nystroem approximation of eigenvectors |
returns a shape model of class pPCA
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 | ### this is a silly example with only 10 landmarks
require(Morpho)
data(boneData)
align <- rigidAlign(boneLM)$rotated
mod <- statismoBuildModel(align)
##extend flexibility using two Gaussian kernels
## Get the empirical kernel first
isoKernel <- IsoKernel(DrawMean(mod),scale=0.001)
kernel1 <- GaussianKernel(10,1)
kernel2 <- GaussianKernel(1,1)
combinedKernel <- SumKernels(kernel1,kernel2)
combinedKernelNoEmp <- SumKernels(combinedKernel,isoKernel)
combinedKernel <- SumKernels(combinedKernelNoEmp,StatisticalModelKernel())
GPmod <- statismoGPmodel(mod,kernel=combinedKernel)
##extend flexibility using two Gaussian kernels but ignoring empiric covariance.
GPmodNoEmp <- statismoGPmodel(mod,kernel=combinedKernelNoEmp)
PC1orig <- DrawSample(mod,2)# get shape in 2sd of first PC of originial model
PC1 <- DrawSample(GPmod,2)# get shape in 2sd of first PC of the extended model
PC1NoEmp <- DrawSample(GPmodNoEmp,2)# get shape in 2sd of first PC
##visualize the differences from the mean (green spheres)
## Not run:
deformGrid3d(PC1,DrawMean(GPmod),ngrid=0)##
##only deviates in 5 landmarks from the mean (dark blue)
deformGrid3d(PC1NoEmp,DrawMean(GPmod),ngrid=0,col1=4,add=TRUE)
deformGrid3d(PC1orig,DrawMean(GPmod),ngrid=0,col1=5,add=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.