View source: R/preproc-generics.R
| fit | R Documentation |
Learn preprocessing parameters from training data. This function fits the preprocessing pipeline to the provided data matrix, learning parameters such as means, standard deviations, or other transformation parameters.
fit(object, X, ...)
object |
A preprocessing object (e.g., |
X |
A matrix or data frame to fit the preprocessing pipeline to |
... |
Additional arguments passed to methods |
A fitted preprocessing object that can be used with transform() and inverse_transform()
fit_transform(), transform(), inverse_transform()
# Fit a centering preprocessor
X <- matrix(rnorm(100), 10, 10)
preproc <- center()
fitted_preproc <- fit(preproc, X)
# Transform new data
X_new <- matrix(rnorm(50), 5, 10)
X_transformed <- transform(fitted_preproc, X_new)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.