unwarp | R Documentation |
These methods apply the inverse transformation T^{-1}
to data
in transformed space - e.g. a feature vector in principal components
space back to the original feature space, in the case of a PCA
transformation.
unwarp(x, ...)
x |
The object to be backtransformed, for example a data frame or a |
... |
Additional arguments to be passed to the |
A data frame with features in the original feature space.
warp()
for the forward transformation, and
pca_warper()
for an example of a simple warper function based
on the principal components transformation.
### Create principal components warper for Maipo data set:
xvars <- c(paste("ndvi0", 1:8, sep = ""), paste("ndwi0", 1:8, sep = ""),
paste("b", outer(1:8,2:7,paste,sep = ""), sep = ""))
fo <- as.formula(paste("class ~", paste(xvars, collapse=" +" )))
d <- maipofields
wrp <- pca_warper(d, xvars = xvars, yvar = "class")
plot(wrp)
round(wrp$pca$rotation[,1:3], digits = 2)
summary(wrp)
# Create a data frame with transformed data:
wd <- warp(d, warper = wrp)
summary(wd)
# Backtransform it, should be identical to d:
d2 <- unwarp(wd, warper = wrp)
all.equal(d, d2[,colnames(d)])
# Default tolerance works for this data set, but you may have to use
# e.g. tol = 10^(-6) for less well conditioned data sets and
# transformations.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.