MinMaxScaler-class: class MinMaxScaler

MinMaxScalerR Documentation

class MinMaxScaler

Description

A class for transforming features by scaling each feature to a given range.

Usage

minmax(x, .min = NULL, .max = NULL, .range = c(0, 1))

inverse_minmax(x, .min, .max, .range = c(0, 1))

Super class

deepANN::Scaler -> MinMaxScaler

Public fields

data_min

('NULL' | numeric vector)
Per feature minimum seen in the data.

data_max

('NULL' | numeric vector)
Per feature maximum seen in the data

feature_range

('integerish vector')
Desired range of transformed data.

Methods

Public methods


Method new()

Creates a new instance of this R6 class.

Usage
MinMaxScaler$new(feature_range = c(0, 1))
Arguments
feature_range

Desired range of transformed data.


Method fit()

Compute the minimum and maximum to be used for later scaling.

Usage
MinMaxScaler$fit(X, axis = 1)
Arguments
X

The data used to compute the per-feature minimum and maximum used for later scaling along the features axis.

axis

The axis along computation is applied.

Returns

The instance self itself.


Method transform()

Scale features according to feature_range.

Usage
MinMaxScaler$transform(X, axis = 1, order = c("C", "F"))
Arguments
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.

Returns

The transformed X.


Method fit_transform()

Run fit() and transform().

Usage
MinMaxScaler$fit_transform(X, axis = 1, order = c("C", "F"))
Arguments
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.

Returns

The transformed X.


Method inverse_transform()

Undo the scaling of X according to feature_range.

Usage
MinMaxScaler$inverse_transform(X, axis = 1, order = c("C", "F"))
Arguments
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.

Returns

The transformed X.


Method clone()

The objects of this class are cloneable with this method.

Usage
MinMaxScaler$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

a <- random_int(dim = c(6, 4), min = 1, max = 30)
scaler <- MinMaxScaler$new()
xt <- scaler$fit_transform(a)
scaler$inverse_transform(xt)

a <- random_int(dim = c(4, 3, 2), min = 1, max = 30)
scaler <- MinMaxScaler$new()
xt <- scaler$fit_transform(a, axis = c(1, 2))
scaler$inverse_transform(xt, axis = c(1, 2))

stschn/deepANN documentation built on June 25, 2024, 7:27 a.m.