library(SME) library(knitr)
df <- data.frame("V1" = 1:3, "V2" = 3:5, "V3" = 5:7) v <- c(1, 3, 5) m <- matrix(c(1,2,3,3,4,5,5,6,7), ncol = 3, byrow = FALSE)
The goal of normalization is to transform features to be on a similar scale, implemented method is max-min normalization:
$x_{normalize} = \frac{x - min(x)}{max(x)-min(x)}$
Currently implemented for numeric vectors, numeric matrices and data.frame normalization.
normalize(x, margin = 1L)
s1 <- normalize(df, margin = 1L) kable(s1)
s2 <- normalize(df, margin = 2L) kable(s2)
s3 <- normalize(m, margin = 1L) kable(s3)
s4 <- normalize(m, margin = 2L) kable(s4)
s5 <- normalize(v) kable(s5)
Standardization rescales data to have a mean (μ) of 0 and standard deviation (σ) of 1 (unit variance).
$x_{standardize} = \frac{x-mean(x)}{\sigma (x)}$
Currently implemented for numeric vectors, numeric matrices and data.frame standardization.
standardize(x, margin = 1L)
A standardize numeric or data.frame.
s1 <- standardize(df, margin = 1L) kable(s1)
s2 <- standardize(df, margin = 2L) kable(s2)
s3 <- standardize(m, margin = 1L) kable(s3)
s4 <- standardize(m, margin = 2L) kable(s4)
s5 <- standardize(v) kable(s5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.