From 535f72068b31ad7c81066f59795e5432faea6078 Mon Sep 17 00:00:00 2001 From: Luke Morris <12477213+morrisLuke@users.noreply.github.com> Date: Wed, 8 Mar 2023 19:15:44 -0800 Subject: [PATCH 1/2] ggplot line call updates in ggplot line calls, size replaced with linewidth to reflect recent package changes. Hope this is helpful and not annoying. Love this book. --- 06_ml_regression.Rmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/06_ml_regression.Rmd b/06_ml_regression.Rmd index 0369210..48f93eb 100644 --- a/06_ml_regression.Rmd +++ b/06_ml_regression.Rmd @@ -262,7 +262,7 @@ These values are quantitative estimates for how well our model performed, and ca svm_rs %>% collect_predictions() %>% ggplot(aes(year, .pred, color = id)) + - geom_abline(lty = 2, color = "gray80", size = 1.5) + + geom_abline(lty = 2, color = "gray80", linewidth = 1.5) + geom_point(alpha = 0.3) + labs( x = "Truth", @@ -352,7 +352,7 @@ This looks pretty promising, so let's explore the predictions for this random fo ```{r rfpredict, dependson="scotusrfrs", opts.label = "fig.large", fig.cap="The random forest model did not perform very sensibly across years, compared to our first attempt using a linear SVM model"} collect_predictions(rf_rs) %>% ggplot(aes(year, .pred, color = id)) + - geom_abline(lty = 2, color = "gray80", size = 1.5) + + geom_abline(lty = 2, color = "gray80", linewidth = 1.5) + geom_point(alpha = 0.3) + labs( x = "Truth", @@ -981,7 +981,7 @@ Now that all of the models with possible parameter values have been trained, we final_rs %>% collect_metrics() %>% ggplot(aes(max_tokens, mean, color = .metric)) + - geom_line(size = 1.5, alpha = 0.5) + + geom_line(linewidth = 1.5, alpha = 0.5) + geom_point(size = 2, alpha = 0.9) + facet_wrap(~.metric, scales = "free_y", ncol = 1) + theme(legend.position = "none") + @@ -1114,7 +1114,7 @@ We can also examine how the true and predicted years compare for the testing set final_fitted %>% collect_predictions() %>% ggplot(aes(year, .pred)) + - geom_abline(lty = 2, color = "gray80", size = 1.5) + + geom_abline(lty = 2, color = "gray80", linewidth = 1.5) + geom_point(alpha = 0.3) + labs( x = "Truth", From ce1d9f0ba8513464032ab161269f7e8f15e8c1a5 Mon Sep 17 00:00:00 2001 From: Luke Morris <12477213+morrisLuke@users.noreply.github.com> Date: Wed, 8 Mar 2023 19:18:46 -0800 Subject: [PATCH 2/2] update ggplot line calls with linewidth in ggplot line calls, size replaced with linewidth to reflect recent package changes. Hope this is helpful and not annoying. Love this book. --- 05_word_embeddings.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_word_embeddings.Rmd b/05_word_embeddings.Rmd index ad9b5c1..21d85df 100644 --- a/05_word_embeddings.Rmd +++ b/05_word_embeddings.Rmd @@ -86,7 +86,7 @@ tibble(frac = 2 ^ seq(-16, -6, 2)) %>% `RAM (in bytes)` = map_dbl(dfm, lobstr::obj_size)) %>% pivot_longer(sparsity:`RAM (in bytes)`, names_to = "measure") %>% ggplot(aes(words, value, color = measure)) + - geom_line(size = 1.5, alpha = 0.5) + + geom_line(linewidth = 1.5, alpha = 0.5) + geom_point(size = 2) + facet_wrap(~measure, scales = "free_y") + scale_x_log10(labels = scales::label_comma()) +