依與其他特徵的相關性進行篩選

R 的降維

Matt Pickard

Owner, Pickard Predictives, LLC

回顧相關性圖的建立

healthcare_df %>% 
  select(where(is.numeric)) %>%

correlate() %>%
shave() %>%
rplot(print_cor = TRUE) +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
R 的降維

相關性圖

醫療公司離職率的相關性圖

R 的降維

相關強度

醫療公司離職率的相關性圖與相關強度區間表

R 的降維

要用相關性篩選嗎?

醫療公司離職率的相關性圖

R 的降維

要用相關性篩選嗎?

百分比加薪與績效評等的維恩圖,顯示高度互資訊重疊

R 的降維

要用相關性篩選嗎?

移除績效評等後的百分比加薪維恩圖

R 的降維

要用相關性篩選嗎?

移除維恩圖的兩部分以示我們刪掉了有價值的資訊

R 的降維

相關性篩選的 recipe

# create and prep the recipe
corr_recipe <-  
  recipe(Attrition ~ ., data = healthcare_df) %>%

step_corr(all_numeric_predictors(), threshold = 0.7) %>%
prep()
# Apply the recipe to the data filtered_healthcare_df <- corr_recipe %>% bake(new_data = NULL)
# Identify the features that were removed tidy(corr_recipe, number = 1)
R 的降維

一起來練習吧!

R 的降維

Preparing Video For Download...