Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

normalize_input

Normalize input data matrix


Description

Mean centers each column of an input data matrix so that it has a mean of zero. Scales the entire matrix so that the largest absolute of the centered matrix is equal to unity.

Usage

normalize_input(X)

Arguments

X

matrix; Input data matrix with rows as observations and columns as variables/dimensions.

Details

Normalization avoids numerical problems when the coordinates (and thus the distances between observations) are very large. Directly computing distances on this scale may lead to underflow when computing the probabilities in the t-SNE algorithm. Rescaling the input values mitigates these problems to some extent.

Value

A numeric matrix of the same dimensions as X but centred by column and scaled to have a maximum deviation of 1.

Author(s)

Aaron Lun

Examples

iris_unique <- unique(iris) # Remove duplicates
iris_matrix <- as.matrix(iris_unique[,1:4])
X <- normalize_input(iris_matrix)
colMeans(X)
range(X)

Rtsne

T-Distributed Stochastic Neighbor Embedding using a Barnes-Hut Implementation

v0.15
file LICENSE
Authors
Jesse Krijthe [aut, cre], Laurens van der Maaten [cph] (Author of original C++ code)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.