Learn R Programming

rtemis (version 1.4.3)

apply_decomposition: Apply a Decomposition to New Data

Description

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

Usage

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

Value

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

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.

Author

EDG

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.

Available for algorithms whose can_apply trait is TRUE; see decomposition_traits. transformed() returns the components of the data the decomposition was fitted on.

Examples

Run this code
iris_pca <- decomp(exc(iris, "Species"), algorithm = "PCA")
apply_decomposition(iris_pca, exc(iris, "Species"))

Run the code above in your browser using DataLab