From 685a22d8f644ab2d1113ea04077246c9e19f672d Mon Sep 17 00:00:00 2001 From: Trevor Campbell Date: Fri, 22 Dec 2023 21:42:53 -0500 Subject: [PATCH] added points to predsel subsec cls2 bughunt --- source/classification2.Rmd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/classification2.Rmd b/source/classification2.Rmd index a9d005167..7431d6aaa 100644 --- a/source/classification2.Rmd +++ b/source/classification2.Rmd @@ -1400,6 +1400,7 @@ res <- tibble(ks = ks, accs = accs, fixedaccs = fixedaccs, nghbrs = nghbrs) plt_irrelevant_accuracies <- ggplot(res) + geom_line(mapping = aes(x=ks, y=accs)) + + geom_point(mapping = aes(x=ks, y=accs)) + labs(x = "Number of Irrelevant Predictors", y = "Model Accuracy Estimate") + theme(text = element_text(size = 18), axis.title=element_text(size=18)) @@ -1420,6 +1421,7 @@ this evidence; if we fix the number of neighbors to $K=3$, the accuracy falls of ```{r 06-neighbors-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "65%", fig.align = "center", fig.cap = "Tuned number of neighbors for varying number of irrelevant predictors."} plt_irrelevant_nghbrs <- ggplot(res) + + geom_point(mapping = aes(x=ks, y=nghbrs)) + geom_line(mapping = aes(x=ks, y=nghbrs)) + labs(x = "Number of Irrelevant Predictors", y = "Tuned number of neighbors") + @@ -1434,6 +1436,7 @@ res_tmp <- res %>% pivot_longer(cols=c("accs", "fixedaccs"), values_to="accuracy") plt_irrelevant_nghbrs <- ggplot(res_tmp) + + geom_point(mapping = aes(x=ks, y=accuracy, color=Type)) + geom_line(mapping = aes(x=ks, y=accuracy, color=Type)) + labs(x = "Number of Irrelevant Predictors", y = "Accuracy") + scale_color_manual(labels= c("Tuned K", "K = 3"), values = c("darkorange", "steelblue")) + @@ -1661,6 +1664,7 @@ where the elbow occurs, and whether adding a variable provides a meaningful incr fwd_sel_accuracies_plot <- accuracies |> ggplot(aes(x = size, y = accuracy)) + + geom_point() + geom_line() + labs(x = "Number of Predictors", y = "Estimated Accuracy") + theme(text = element_text(size = 20), axis.title=element_text(size=20))