tl_reduce_dimensions: Integration Functions: Combining Supervised and Unsupervised...

View source: R/integration.R

tl_reduce_dimensionsR Documentation

Integration Functions: Combining Supervised and Unsupervised Learning

Description

These functions demonstrate the power of tidylearn's unified approach by seamlessly integrating supervised and unsupervised learning techniques. Feature Engineering via Dimensionality Reduction

Usage

tl_reduce_dimensions(
  data,
  response = NULL,
  method = "pca",
  n_components = NULL,
  ...
)

Arguments

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

Details

Use PCA, MDS, or other dimensionality reduction as a preprocessing step for supervised learning. This can improve model performance and interpretability.

Value

A list containing the transformed data and the reduction model

Examples


# Reduce dimensions before classification
reduced <- tl_reduce_dimensions(iris, response = "Species", method = "pca", n_components = 3)
model <- tl_model(reduced$data, Species ~ ., method = "logistic")


tidylearn documentation built on Feb. 6, 2026, 5:07 p.m.