เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Prepping the stage

You are going to explore the attrition_num dataset from the point of view of PCA to understand if it is feasible to reduce dimensionality while preserving most information. Start by creating a recipe that filters our near-zero variance features, normalizes the data, and implements PCA.

The attrition_num dataset is already loaded for you.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Feature Engineering in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Remove possible near-zero variance features.
  • Normalize all numeric data.
  • Apply PCA.
  • Access the names of the output elements by preparing the recipe.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

pc_recipe <- recipe(~., data = attrition_num) %>%

# Remove possible near-zero variance features
  ___(all_numeric()) %>%

# Normalize all numeric data
  ___(___()) %>%

# Apply PCA
  ___(all_numeric())

# Access the names of the output elements by preparing the recipe
pca_output <- ___(___)
names(pca_output)
แก้ไขและรันโค้ด