@@ -26,7 +26,7 @@ print_tidymodels <- function(tidymodels_object) {
26
26
}
27
27
}
28
28
29
- theme_update(axis.title = element_text(size = 14 )) # modify axis label size in plots
29
+ theme_update(axis.title = element_text(size = 12 )) # modify axis label size in plots
30
30
31
31
```
32
32
@@ -232,7 +232,7 @@ perim_concav <- cancer |>
232
232
labs(color = "Diagnosis") +
233
233
scale_color_manual(labels = c("Malignant", "Benign"),
234
234
values = c("orange2", "steelblue2")) +
235
- theme(text = element_text(size = 14 ))
235
+ theme(text = element_text(size = 12 ))
236
236
237
237
perim_concav
238
238
```
@@ -788,7 +788,7 @@ accuracy_vs_k <- ggplot(accuracies, aes(x = neighbors, y = mean)) +
788
788
geom_point() +
789
789
geom_line() +
790
790
labs(x = "Neighbors", y = "Accuracy Estimate") +
791
- theme(text = element_text(size = 14 ))
791
+ theme(text = element_text(size = 12 ))
792
792
793
793
accuracy_vs_k
794
794
```
@@ -846,7 +846,7 @@ accuracy_vs_k_lots <- ggplot(accuracies, aes(x = neighbors, y = mean)) +
846
846
geom_point() +
847
847
geom_line() +
848
848
labs(x = "Neighbors", y = "Accuracy Estimate") +
849
- theme(text = element_text(size = 14 ))
849
+ theme(text = element_text(size = 12 ))
850
850
851
851
accuracy_vs_k_lots
852
852
```
@@ -926,7 +926,7 @@ for (i in 1:length(ks)) {
926
926
ggtitle(paste("K = ", ks[[i]])) +
927
927
scale_color_manual(labels = c("Malignant", "Benign"),
928
928
values = c("orange2", "steelblue2")) +
929
- theme(text = element_text(size = 18))
929
+ theme(text = element_text(size = 18), axis.title=element_text(size=18))
930
930
}
931
931
932
932
p_no_legend <- lapply(plots, function(x) x + theme(legend.position = "none"))
@@ -1036,7 +1036,7 @@ variables there are, the more (random) influence they have, and the more they
1036
1036
corrupt the set of nearest neighbors that vote on the class of the new
1037
1037
observation to predict.
1038
1038
1039
- ``` {r 06-performance-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "60 %", fig.cap = "Effect of inclusion of irrelevant predictors."}
1039
+ ``` {r 06-performance-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "65 %", fig.cap = "Effect of inclusion of irrelevant predictors."}
1040
1040
# get accuracies after including k irrelevant features
1041
1041
ks <- c(0, 5, 10, 15, 20, 40)
1042
1042
fixedaccs <- list()
@@ -1110,7 +1110,7 @@ plt_irrelevant_accuracies <- ggplot(res) +
1110
1110
geom_line(mapping = aes(x=ks, y=accs)) +
1111
1111
labs(x = "Number of Irrelevant Predictors",
1112
1112
y = "Model Accuracy Estimate") +
1113
- theme(text = element_text(size = 18))
1113
+ theme(text = element_text(size = 16), axis.title=element_text(size=16))
1114
1114
1115
1115
plt_irrelevant_accuracies
1116
1116
```
@@ -1126,12 +1126,12 @@ variables, the number of neighbors does not increase smoothly; but the general t
1126
1126
Figure \@ ref(fig:06-fixed-irrelevant-features) corroborates
1127
1127
this evidence; if we fix the number of neighbors to $K=3$, the accuracy falls off more quickly.
1128
1128
1129
- ``` {r 06-neighbors-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "60 %", fig.cap = "Tuned number of neighbors for varying number of irrelevant predictors."}
1129
+ ``` {r 06-neighbors-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "65 %", fig.cap = "Tuned number of neighbors for varying number of irrelevant predictors."}
1130
1130
plt_irrelevant_nghbrs <- ggplot(res) +
1131
1131
geom_line(mapping = aes(x=ks, y=nghbrs)) +
1132
1132
labs(x = "Number of Irrelevant Predictors",
1133
1133
y = "Number of neighbors") +
1134
- theme(text = element_text(size = 18))
1134
+ theme(text = element_text(size = 16), axis.title=element_text(size=16))
1135
1135
1136
1136
plt_irrelevant_nghbrs
1137
1137
```
@@ -1145,7 +1145,7 @@ plt_irrelevant_nghbrs <- ggplot(res_tmp) +
1145
1145
geom_line(mapping = aes(x=ks, y=accuracy, color=Type)) +
1146
1146
labs(x = "Number of Irrelevant Predictors", y = "Accuracy") +
1147
1147
scale_color_discrete(labels= c("Tuned K", "K = 3")) +
1148
- theme(text = element_text(size = 16))
1148
+ theme(text = element_text(size = 16), axis.title=element_text(size=16))
1149
1149
1150
1150
plt_irrelevant_nghbrs
1151
1151
```
@@ -1373,12 +1373,12 @@ where the elbow occurs, and whether adding a variable provides a meaningful incr
1373
1373
> part of tuning your classifier, you * cannot use your test data* for this
1374
1374
> process!
1375
1375
1376
- ``` {r 06-fwdsel-3, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "60 %", fig.cap = "Estimated accuracy versus the number of predictors for the sequence of models built using forward selection."}
1376
+ ``` {r 06-fwdsel-3, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "65 %", fig.cap = "Estimated accuracy versus the number of predictors for the sequence of models built using forward selection."}
1377
1377
fwd_sel_accuracies_plot <- accuracies |>
1378
1378
ggplot(aes(x = size, y = accuracy)) +
1379
1379
geom_line() +
1380
1380
labs(x = "Number of Predictors", y = "Estimated Accuracy") +
1381
- theme(text = element_text(size = 18))
1381
+ theme(text = element_text(size = 18), axis.title=element_text(size=18))
1382
1382
1383
1383
fwd_sel_accuracies_plot
1384
1384
```
0 commit comments