Skip to content

Commit

Permalink
added points to predsel subsec cls2 bughunt
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Dec 23, 2023
1 parent d510f31 commit 685a22d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/classification2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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") +
Expand All @@ -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")) +
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 685a22d

Please sign in to comment.