apply_decomp: Apply Decomposition to New Data

View source: R/170_Decomposition.R

apply_decompR Documentation

Apply Decomposition to New Data

Description

Apply a fitted decomposition to new data for algorithms that support this.

Usage

apply_decomp(decom, new_data, execution_config = NULL, verbosity = 1L)

Arguments

decom

Decomposition object.

new_data

Tabular data (data.frame, data.table, or tibble): New data to which the decomposition will be applied.

execution_config

Optional ExecutionConfig object: Threads for an algorithm whose threaded trait is TRUE are its n_workers_algorithm, or its worker count. NULL uses the host's default worker count.

verbosity

Integer: Verbosity level

Details

A fit is learned on the columns decom@config@features names, so only those columns of new_data are transformed; the remaining columns are returned unchanged, alongside the learned components, in the layout ⁠[kept features, components]⁠. decomp() resolves an unset features to the numeric columns and records them, so a fit it produced always names them. A Decomposition assembled by hand with no features transforms every column of new_data and returns only the components.

Value

A data.frame of the learned components for new_data, preceded by any feature columns that were not decomposed.

Author(s)

EDG

Examples

iris_pca <- decomp(exc(iris, "Species"), algorithm = "PCA")
apply_decomp(iris_pca, exc(iris, "Species"))

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.