scaling | R Documentation |
Collection of Different Scaling Methods.
scaling(Xtrain,Xtest=NULL, method = "autoscaling")
Xtrain |
a matrix of data (training data set). |
Xtest |
a matrix of data (test data set).(by default = NULL). |
method |
the scaling method to be used. Choices are " |
A number of different scaling methods are provided:
"none
": no scaling method is applied.
"centering
": centers the mean to zero.
"autoscaling
": centers the mean to zero and scales data by dividing each variable by the variance.
"rangescaling
": centers the mean to zero and scales data by dividing each variable by the difference between the minimum and the maximum value.
"paretoscaling
": centers the mean to zero and scales data by dividing each variable by the square root of the standard deviation. Unit scaling divides each variable by the standard deviation so that each variance equal to 1.
The function returns a list with 1 item or 2 items (if a test data set is present):
newXtrain |
a scaled matrix (training data set). |
newXtest |
a scale matrix (test data set). |
Stefano Cacciatore and Leonardo Tenori
van den Berg RA, Hoefsloot HCJ, Westerhuis JA, et al.
Centering, scaling, and transformations: improving the biological information content of metabolomics data.
BMC Genomics 2006;7(1):142.
Cacciatore S, Luchinat C, Tenori L
Knowledge discovery by accuracy maximization.
Proc Natl Acad Sci U S A 2014;111(14):5117-22. doi: 10.1073/pnas.1220873111. Link
Cacciatore S, Tenori L, Luchinat C, Bennett PR, MacIntyre DA
KODAMA: an updated R package for knowledge discovery and data mining.
Bioinformatics 2017;33(4):621-623. doi: 10.1093/bioinformatics/btw705. Link
normalization
data(MetRef) u=MetRef$data; u=u[,-which(colSums(u)==0)] u=normalization(u)$newXtrain u=scaling(u)$newXtrain class=as.numeric(as.factor(MetRef$gender)) cc=pca(u) plot(cc$x,pch=21,bg=class,xlab=cc$txt[1],ylab=cc$txt[2])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.