@@ -1400,6 +1400,7 @@ res <- tibble(ks = ks, accs = accs, fixedaccs = fixedaccs, nghbrs = nghbrs)
1400
1400
1401
1401
plt_irrelevant_accuracies <- ggplot(res) +
1402
1402
geom_line(mapping = aes(x=ks, y=accs)) +
1403
+ geom_point(mapping = aes(x=ks, y=accs)) +
1403
1404
labs(x = "Number of Irrelevant Predictors",
1404
1405
y = "Model Accuracy Estimate") +
1405
1406
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
1420
1421
1421
1422
``` {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."}
1422
1423
plt_irrelevant_nghbrs <- ggplot(res) +
1424
+ geom_point(mapping = aes(x=ks, y=nghbrs)) +
1423
1425
geom_line(mapping = aes(x=ks, y=nghbrs)) +
1424
1426
labs(x = "Number of Irrelevant Predictors",
1425
1427
y = "Tuned number of neighbors") +
@@ -1434,6 +1436,7 @@ res_tmp <- res %>% pivot_longer(cols=c("accs", "fixedaccs"),
1434
1436
values_to="accuracy")
1435
1437
1436
1438
plt_irrelevant_nghbrs <- ggplot(res_tmp) +
1439
+ geom_point(mapping = aes(x=ks, y=accuracy, color=Type)) +
1437
1440
geom_line(mapping = aes(x=ks, y=accuracy, color=Type)) +
1438
1441
labs(x = "Number of Irrelevant Predictors", y = "Accuracy") +
1439
1442
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
1661
1664
1662
1665
fwd_sel_accuracies_plot <- accuracies |>
1663
1666
ggplot(aes(x = size, y = accuracy)) +
1667
+ geom_point() +
1664
1668
geom_line() +
1665
1669
labs(x = "Number of Predictors", y = "Estimated Accuracy") +
1666
1670
theme(text = element_text(size = 20), axis.title=element_text(size=20))
0 commit comments