StandardScaler | R Documentation |
A class for transforming features by removing the mean and scaling to unit standard deviation.
zscore(x, .mean, .sd)
inverse_zscore(x, .mean, .sd)
deepANN::Scaler
-> StandardScaler
mean
('NULL' | numeric vector)
The mean value for each feature.
std
('NULL' | numeric vector)
The standard deviation for each feature.
with_mean
('NULL' | logical)
If true, center the data before scaling.
with_std
('NULL' | logical)
If true, scale the data to unit standard deviation.
new()
Creates a new instance of this R6 class.
StandardScaler$new(with_mean = TRUE, with_std = TRUE)
with_mean
If true, center the data before scaling.
with_std
if true, scale the data to unit standard deviation
fit()
Compute the mean and std to be used for later scaling.
StandardScaler$fit(X, axis = 1)
X
The data used to compute the per-feature mean and std used for later scaling along the features axis.
axis
The axis along computation is applied.
The instance self
itself.
transform()
Perform standardization by centering and scaling.
StandardScaler$transform(X, axis = 1, order = c("C", "F"))
X
The data that will be transformed.
axis
The axis along scaling is applied.
order
The order in which elements of data should be read during scaling. By default, the order is equivalent to the C-style ordering and means elements should be read in row-major order. In opposite, the Fortran-style ordering means elements should be read in column-major order.
The transformed X
.
fit_transform()
Run fit()
and transform()
.
StandardScaler$fit_transform(X, axis = 1, order = c("C", "F"))
X
The data that will be transformed.
axis
The axis along scaling is applied.
order
The order in which elements of data should be read during scaling. By default, the order is equivalent to the C-style ordering and means elements should be read in row-major order. In opposite, the Fortran-style ordering means elements should be read in column-major order.
The transformed X
.
inverse_transform()
Scale back X
to the original representation.
StandardScaler$inverse_transform(X, axis = 1, order = c("C", "F"))
X
The data that will be transformed.
axis
The axis along scaling is applied.
order
The order in which elements of data should be read during scaling. By default, the order is equivalent to the C-style ordering and means elements should be read in row-major order. In opposite, the Fortran-style ordering means elements should be read in column-major order.
The transformed X
.
clone()
The objects of this class are cloneable with this method.
StandardScaler$clone(deep = FALSE)
deep
Whether to make a deep clone.
a <- random_int(dim = c(6, 4), min = 1, max = 30)
scaler <- StandardScaler$new()
xt <- scaler$fit_transform(a)
scaler$inverse_transform(xt)
a <- random_int(dim = c(4, 3, 2), min = 1, max = 30)
scaler <- StandardScaler$new()
xt <- scaler$fit_transform(a, axis = c(1, 2))
scaler$inverse_transform(xt, axis = c(1, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.