统一流形近似与投影(UMAP)

R 中的降维

Matt Pickard

Owner, Pickard Predictives, LLC

PCA、t-SNE 与 UMAP

PCA、t-SNE 与 UMAP 对比

R 中的降维

PCA、t-SNE 与 UMAP

PCA、t-SNE 与 UMAP 对比

R 中的降维

PCA、t-SNE 与 UMAP

PCA、t-SNE 与 UMAP 对比

R 中的降维

PCA、t-SNE 与 UMAP

PCA、t-SNE 与 UMAP 对比

R 中的降维

PCA、t-SNE 与 UMAP

PCA、t-SNE 与 UMAP 对比

UMAP 具有可调的类似超参数。

R 中的降维

UMAP 图

library(embed)

set.seed(1234) umap_df <- recipe(Attrition ~ ., data = attrition_df) %>% step_normalize(all_predictors()) %>% step_umap(all_predictors(), num_comp = 2) %>% prep() %>% juice()
umap_df %>% ggplot(aes(x = UMAP1, y = UMAP2, color = Attrition)) + geom_point(alpha = 0.7)
R 中的降维

UMAP:员工流失

员工流失的 UMAP 图

R 中的降维

tidymodels 中的 UMAP

创建配方

umap_recipe <-  recipe(Attrition ~ ., data = train) %>% 
  step_normalize(all_predictors()) %>% 
  step_umap(all_predictors(), num_comp = 4)

创建模型规范

umap_lr_model <- linear_reg()
R 中的降维

tidymodels 中的 UMAP

创建工作流

umap_lr_workflow <-  workflow() %>% 
  add_recipe(umap_recipe) %>% 
  add_model(umap_lr_model)

拟合工作流

umap_lr_fit <- umap_lr_workflow %>% 
  fit(data = train)
R 中的降维

tidymodels 中的 UMAP

评估模型

predict_umap_df <- test %>% 
  bind_cols(predict = predict(umap_lr_fit, test))

rmse(predict_umap_df, Attrition, .pred_class)
R 中的降维

让我们来练习!

R 中的降维

Preparing Video For Download...