| MLLpNormScaler | R Documentation |
Scales input features to unit norm based on the chosen L1 or
L2 formulation. The center/scale arguments follow R's
scale(): the norm is computed around the applied
center (around 0 when center = FALSE).
The *_inplace methods mutate X directly (zero-copy)
when it is a double-storage matrix; other inputs are coerced to a double
matrix first, in which case the coerced copy is modified. The (modified)
matrix is returned in both cases. X may also be an
mmap_matrix created by mem_matrix /
mem_matrix_from: the disk-backed buffer is then
bound zero-copy through the same Eigen map interface and modified in
place on disk. All scaler methods — including fit() — require the
handle to be open in "readwrite" mode, because the scaler core
binds a mutable map.
MLLpNormScaler$new()Initialize the MLLpNormScaler
MLLpNormScaler$new( norm_type = 2, center = TRUE, scale = TRUE, n_threads = NULL )
norm_typeInteger, 1 for L1 norm, 2 for L2 norm (default: 2)
centerLogical, whether to center columns to mean 0 (default: TRUE)
scaleLogical, whether to scale columns to unit Lp norm (default: TRUE)
n_threadsInteger, the thread budget of the column passes
(NULL, the default: the library's default budget,
trex_get_num_threads(), initially 1).
MLLpNormScaler$fit()Compute the norm parameters.
MLLpNormScaler$fit(X, threshold = 1e-12)
XA numeric matrix (n x p) or an mmap_matrix in
"readwrite" mode (the scaler core binds a mutable map).
thresholdDouble, lower bound for the scale statistic (default: 1e-12).
Value.
MLLpNormScaler$transform_inplace()Perform standardization in-place.
MLLpNormScaler$transform_inplace(X)
XA numeric matrix (n x p) or an mmap_matrix in
"readwrite" mode.
The modified matrix X (the same handle for an mmap_matrix).
MLLpNormScaler$inverse_transform_inplace()Inverse transform to original scale.
MLLpNormScaler$inverse_transform_inplace(X)
XA numeric matrix (n x p) or an mmap_matrix in
"readwrite" mode.
The modified matrix X (the same handle for an mmap_matrix).
MLLpNormScaler$fit_transform_inplace()Fit and transform in one call, like R's scale().
MLLpNormScaler$fit_transform_inplace(X, threshold = 1e-12)
XA numeric matrix (n x p) or an mmap_matrix in
"readwrite" mode.
thresholdDouble, lower bound for the scale statistic (default: 1e-12).
The modified matrix X (the same handle for an mmap_matrix).
MLLpNormScaler$is_fitted()Check if scaler is fitted.
MLLpNormScaler$is_fitted()
Value.
MLLpNormScaler$get_dropped_indices()Get dropped (degenerate) column indices. These columns get scale factor 1 and are still centered (sklearn semantics).
MLLpNormScaler$get_dropped_indices()
Value.
MLLpNormScaler$get_centers()Get the learned centers (column means).
MLLpNormScaler$get_centers()
Value.
MLLpNormScaler$get_scales()Get the learned scales.
MLLpNormScaler$get_scales()
Value.
MLLpNormScaler$get_center()Check if scaler centers data.
MLLpNormScaler$get_center()
Value.
MLLpNormScaler$get_scale()Check if scaler scales data to unit norm.
MLLpNormScaler$get_scale()
Value.
MLLpNormScaler$get_norm_type()Get norm type (1 for L1, 2 for L2).
MLLpNormScaler$get_norm_type()
Value.
MLLpNormScaler$save()Save model state to file.
MLLpNormScaler$save(filename)
filenameString path to save output.
Value.
MLLpNormScaler$load()Load model state from file.
MLLpNormScaler$load(filename)
filenameString path to load input from.
Value.
MLLpNormScaler$clone()The objects of this class are cloneable with this method.
MLLpNormScaler$clone(deep = FALSE)
deepWhether to make a deep clone.
Other ML methods:
MLElasticNet,
MLElasticNetCV,
MLPCA,
MLRidge,
MLRidgeCV,
MLSVD,
MLZScoreScaler,
ml_agglomerative_cluster(),
ml_cut_tree(),
ml_distance_metric,
ml_linkage_method
set.seed(1)
X <- matrix(rnorm(50 * 5), 50, 5)
scaler <- MLLpNormScaler$new(norm_type = 2)
scaler$fit(X)
X_norm <- scaler$transform_inplace(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.