Learn R Programming

SVMMaj (version 0.2-2)

normalize: Normalize/standardize the colums 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".

References

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

See Also

svmmaj

Examples

Run this code
# NOT RUN {
## 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'))

# }

Run the code above in your browser using DataLab