diff --git a/figures/conf_matrix1.png b/figures/conf_matrix1.png new file mode 100644 index 0000000..bbe45d4 Binary files /dev/null and b/figures/conf_matrix1.png differ diff --git a/figures/conf_matrix2.png b/figures/conf_matrix2.png new file mode 100644 index 0000000..099a57f Binary files /dev/null and b/figures/conf_matrix2.png differ diff --git a/figures/metrics.png b/figures/metrics.png new file mode 100644 index 0000000..b2602e5 Binary files /dev/null and b/figures/metrics.png differ diff --git a/figures/roc_1.png b/figures/roc_1.png new file mode 100644 index 0000000..6d54f93 Binary files /dev/null and b/figures/roc_1.png differ diff --git a/figures/roc_2.png b/figures/roc_2.png new file mode 100644 index 0000000..b0ddb2a Binary files /dev/null and b/figures/roc_2.png differ diff --git a/figures/vip_1.png b/figures/vip_1.png new file mode 100644 index 0000000..54adecf Binary files /dev/null and b/figures/vip_1.png differ diff --git a/figures/vip_2.png b/figures/vip_2.png new file mode 100644 index 0000000..b0ce806 Binary files /dev/null and b/figures/vip_2.png differ diff --git a/validation_rf.R b/validation_rf.R index 7e0e93c..a7af530 100644 --- a/validation_rf.R +++ b/validation_rf.R @@ -16,14 +16,34 @@ pred_dfs <- read_rds("data/predictions.RDS") source("funs_valid.R") all_metrics <- get_all_metrics(pred_dfs) +all_metrics %>% + dplyr::select(-2) %>% + kable(format = "html") %>% + save_kable("figures/metrics.png") -pred_dfs[[1]][[1]] %>% exportable_conf_matrix %>% kable(format = "markdown") +pred_dfs[[1]][[1]] %>% + exportable_conf_matrix %>% + kable(format = "html") %>% + save_kable("figures/conf_matrix1.png") -# df_pred_probs1 %>% roc_curve(Exited, .pred_No) %>% autoplot() -# df_pred_probs2 %>% roc_curve(Exited, .pred_No) %>% autoplot() -# -# vi(ranger_model_1) -# vi(ranger_model_2) -# -# vip(ranger_model_1) -# vip(ranger_model_2) \ No newline at end of file +pred_dfs[[2]][[1]] %>% + exportable_conf_matrix %>% + kable(format = "html") %>% + save_kable("figures/conf_matrix2.png") + +roc_1 <- pred_dfs[[1]][[1]] %>% + roc_curve(Exited, .pred_No) %>% + autoplot() + +roc_2 <- pred_dfs[[2]][[1]] %>% + roc_curve(Exited, .pred_No) %>% + autoplot() + +ggsave("figures/roc_1.png", roc_1) +ggsave("figures/roc_2.png", roc_2) + +vip_1 <- vip(fitted_models[[1]][[1]]) +vip_2 <- vip(fitted_models[[2]][[1]]) + +ggsave("figures/vip_1.png", vip_1) +ggsave("figures/vip_2.png", vip_2)