| tl_reduce_dimensions | R Documentation |
These functions demonstrate the power of tidylearn's unified approach by seamlessly integrating supervised and unsupervised learning techniques. Feature Engineering via Dimensionality Reduction
tl_reduce_dimensions(
data,
response = NULL,
method = "pca",
n_components = NULL,
...
)
data |
A data frame |
response |
Response variable name (will be preserved) |
method |
Dimensionality reduction method: "pca", "mds" |
n_components |
Number of components to retain |
... |
Additional arguments for the dimensionality reduction method |
Use PCA, MDS, or other dimensionality reduction as a preprocessing step for supervised learning. This can improve model performance and interpretability.
A list containing the transformed data and the reduction model
# Reduce dimensions before classification
reduced <- tl_reduce_dimensions(iris, response = "Species", method = "pca", n_components = 3)
model <- tl_model(reduced$data, Species ~ ., method = "logistic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.