knitr::opts_chunk$set(warning = FALSE, messages = FALSE) library(tidymodels)
We see that the lasso model performed better with lower amounts of regularization.
targets::tar_read(tuningLasso) |> autoplot()
tune::show_best(targets::tar_read(tuningLasso))|> gt::gt()
best <- select_best(targets::tar_read(tuningLasso)) lasso_best <- finalize_workflow( targets::tar_read(workflowLasso), best ) lasso_best |> fit(targets::tar_read(training)) |> extract_fit_parsnip() |> vip::vi(lambda = best$penalty) |> mutate( Importance = abs(Importance), Variable = forcats::fct_reorder(Variable, Importance) ) |> ggplot(aes(x = Importance, y = Variable, fill = Sign)) + geom_col() + scale_x_continuous(expand = c(0, 0)) + labs(y = NULL)
Only run when predictor set and parameters for the model are selected.
# targets::tar_read(lassoFinal)|>collect_metrics()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.