Create 3_model_outputs.R
This commit is contained in:
parent
20e4375073
commit
22bc31da44
1 changed files with 62 additions and 0 deletions
62
ML/3_model_outputs.R
Normal file
62
ML/3_model_outputs.R
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
# The following script is for graphing of models
|
||||||
|
rm(list = ls(all.names = TRUE)) # Clear the memory of variables from previous run.
|
||||||
|
cat("\014") # Clear the console
|
||||||
|
|
||||||
|
|
||||||
|
# load packages -----------------------------------------------------------
|
||||||
|
|
||||||
|
box::use(
|
||||||
|
magrittr[`%>%`]
|
||||||
|
,here[here]
|
||||||
|
,readr
|
||||||
|
,gp2 = ggplot2[ggplot, aes]
|
||||||
|
,rsample
|
||||||
|
,r = recipes
|
||||||
|
,wf = workflows
|
||||||
|
,p = parsnip[tune]
|
||||||
|
,ys = yardstick
|
||||||
|
,d = dials
|
||||||
|
,rsamp = rsample
|
||||||
|
,tune
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# globals -----------------------------------------------------------------
|
||||||
|
|
||||||
|
set.seed(070823) #set seed for reproducible research
|
||||||
|
|
||||||
|
|
||||||
|
# load-data ---------------------------------------------------------------
|
||||||
|
|
||||||
|
screen_workflows_reg <- readr::read_rds(here("ML","outputs","workflowscreen_reg.rds"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# graphing ----------------------------------------------------------------
|
||||||
|
|
||||||
|
reg_results <- screen_workflows_reg %>%
|
||||||
|
workflowsets::rank_results() %>%
|
||||||
|
dplyr::filter(.metric == "rmse") %>%
|
||||||
|
dplyr::select(model, .config, rmse = mean, rank)
|
||||||
|
|
||||||
|
#TODO Save this for paper
|
||||||
|
ggplot2::autoplot(
|
||||||
|
screen_workflows_reg
|
||||||
|
,rank_metric = "rmse"
|
||||||
|
,metric = "rmse"
|
||||||
|
,select_best = TRUE
|
||||||
|
) +
|
||||||
|
ggplot2::geom_text(ggplot2::aes(y = mean, label = wflow_id)
|
||||||
|
# ,angle = 90
|
||||||
|
,hjust = -0.2
|
||||||
|
) +
|
||||||
|
ggplot2::theme_bw() +
|
||||||
|
ggplot2::scale_color_manual(values = rep("black", times = 5)) +
|
||||||
|
ggplot2::theme(legend.position = "none")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue