Pre-Processing of Predictors
Pre-processing transformation (centering, scaling etc) can be estimated from the training data and applied to any data set with the same variables.
## S3 method for class 'default': preProcess(x, method = c("center", "scale"), thresh = 0.95, na.remove = TRUE, ...)
## S3 method for class 'preProcess': predict(object, newdata, ...)
- a matrix or data frame. All variables must be numeric.
- a character vector specifying the type of processing. Possible values are "center", "scale", "pca" "ica" and "spartialSign" (see Details below)
- a cutoff for the cumulative percent of variance to be retained by PCA
- a logical; should missing values be removed from the calculations?
- an object of class
- a matrix or data frame of new data to be pre-processed
- additional arguments to pass to
fastICA, such as
The operations are applied in this order: centering, scaling, PCA, ICA then spatial sign.
If PCA is requested but scaling is not, the values will still be scaled. Similarly, when ICA is requested, the data are automatically centered.
A warning is thrown if both PCA and ICA are requested. ICA, as implemented bt the
fastICA package automatically does a PCA decomposition prior to finding the ICA scores.
The function will throw an error of any variables in
x has less than two unique values.
preProcessresults in a list with elements
call the function call dim the dimensions of
mean a vector of means (if centering was requested) std a vector of standard deviations (if scaling or PCA was requested) rotation a matrix of eigenvectors if PCA was requested method the value of
thresh the value of
numComp the number of principal components required of capture the specified amount of variance ica contains values for the
Kmatrix of the decomposition
Kuhn (2008), ``Building Predictive Models in R Using the caret'' (
data(BloodBrain) # one variable has one unique value preProc <- preProcess(bbbDescr[1:100,]) preProc <- preProcess(bbbDescr[1:100,-3]) training <- predict(preProc, bbbDescr[1:100,-3]) test <- predict(preProc, bbbDescr[101:208,-3])