Skip to content

Commit

Permalink
Implemented calculation and export od all, crucial model validation s…
Browse files Browse the repository at this point in the history
…tatistics. Actual solution is not fully automated. Exported graphics.
  • Loading branch information
Jakub Cierocki committed May 10, 2020
1 parent 961f143 commit 7294c7c
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 9 deletions.
Binary file added figures/conf_matrix1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/conf_matrix2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/metrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/roc_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/roc_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/vip_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/vip_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 29 additions & 9 deletions validation_rf.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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)

0 comments on commit 7294c7c

Please sign in to comment.