Get startedGet started for free

UMAP reduction in a decision tree model

Now that you have visualized a UMAP reduction, let's put UMAP to work in model building. In this exercise, you will build a workflow that applies UMAP in a preprocessing recipe to the credit data and then use the extracted components to build a decision tree model. The credit data train and test sets are provided for you. The embed library has already been loaded.

This exercise is part of the course

Dimensionality Reduction in R

View Course

Exercise instructions

  • Create a recipe to apply a UMAP reduction to the data, resulting in four extracted components.
  • Create a decision_tree model for classification.
  • Add the UMAP recipe and the decision tree model to a workflow.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a recipe to apply UMAP feature extraction
umap_recipe <-  recipe(___ ~ ___, data = ___) %>% 
  ___(___()) %>% 
  ___(___(), outcome = vars(___), num_comp = ___)

# Specify a decision tree model
umap_dt_model <- ___(___ = "___")

# Add the recipe and model to a workflow
umap_dt_workflow <-  ___() %>% 
  add_recipe(___) %>% 
  add_model(___)
umap_dt_workflow
Edit and Run Code