normalize: Normalize/standardize the columns of a matrix

View source: R/normalize.R

normalizeR Documentation

Normalize/standardize the columns of a matrix

Description

Standardize the columns of an attribute matrix X to zscores, to the range [0 1] or a prespecified scale.

Usage

normalize(x, standardize = "zscore")

Arguments

x

An attribute variable which will be scaled.

standardize

Either a string value denoting a predefined scaling, or a list with values a and b corresponding with the numeric centering and scaling, that is, using the function x * standardize$b - standardize$a.

Value

The standardized matrix. The numeric centering and scalings used are returned as attribute "standardize".

Author(s)

Hok San Yip, Patrick J.F. Groenen, Georgi Nalbantov

References

P.J.F. Groenen, G. Nalbantov and J.C. Bioch (2008) SVM-Maj: a majorization approach to linear support vector machines with different hinge errors.

See Also

svmmaj

Examples


## standardize the first 50 objects to zscores
x  <- iris$Sepal.Length
x1 <- normalize(x[1:50], standardize = 'zscore')
## use the same settings to apply to the next 100 observations
x2 <- normalize(x[-(1:50)], standardize = attr(x1, 'standardization'))

SVMMaj documentation built on Sept. 11, 2024, 6:06 p.m.