Skip to content

Commit 534cc78

Browse files
committed
adjusting fig sizes
1 parent a8b24f6 commit 534cc78

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

classification2.Rmd

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ for (i in 1:length(ks)) {
895895
ggtitle(paste("K = ", ks[[i]])) +
896896
scale_color_manual(labels = c("Malignant", "Benign"),
897897
values = c("orange2", "steelblue2")) +
898-
theme(text = element_text(size = 16))
898+
theme(text = element_text(size = 18))
899899
}
900900
901901
p_no_legend <- lapply(plots, function(x) x + theme(legend.position = "none"))
@@ -1005,7 +1005,7 @@ variables there are, the more (random) influence they have, and the more they
10051005
corrupt the set of nearest neighbors that vote on the class of the new
10061006
observation to predict.
10071007

1008-
```{r 06-performance-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "75%", fig.cap = "Effect of inclusion of irrelevant predictors."}
1008+
```{r 06-performance-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "60%", fig.cap = "Effect of inclusion of irrelevant predictors."}
10091009
# get accuracies after including k irrelevant features
10101010
ks <- c(0, 5, 10, 15, 20, 40)
10111011
fixedaccs <- list()
@@ -1078,7 +1078,8 @@ res <- tibble(ks = ks, accs = accs, fixedaccs = fixedaccs, nghbrs = nghbrs)
10781078
plt_irrelevant_accuracies <- ggplot(res) +
10791079
geom_line(mapping = aes(x=ks, y=accs)) +
10801080
labs(x = "Number of Irrelevant Predictors",
1081-
y = "Model Accuracy Estimate")
1081+
y = "Model Accuracy Estimate") +
1082+
theme(text = element_text(size = 18))
10821083
10831084
plt_irrelevant_accuracies
10841085
```
@@ -1094,11 +1095,12 @@ variables, the number of neighbors does not increase smoothly; but the general t
10941095
Figure \@ref(fig:06-fixed-irrelevant-features) corroborates
10951096
this evidence; if we fix the number of neighbors to $K=3$, the accuracy falls off more quickly.
10961097

1097-
```{r 06-neighbors-irrelevant-features, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "75%", fig.cap = "Tuned number of neighbors for varying number of irrelevant predictors."}
1098+
```{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."}
10981099
plt_irrelevant_nghbrs <- ggplot(res) +
10991100
geom_line(mapping = aes(x=ks, y=nghbrs)) +
11001101
labs(x = "Number of Irrelevant Predictors",
1101-
y = "Number of neighbors")
1102+
y = "Number of neighbors") +
1103+
theme(text = element_text(size = 18))
11021104
11031105
plt_irrelevant_nghbrs
11041106
```
@@ -1111,7 +1113,8 @@ res_tmp <- res %>% pivot_longer(cols=c("accs", "fixedaccs"),
11111113
plt_irrelevant_nghbrs <- ggplot(res_tmp) +
11121114
geom_line(mapping = aes(x=ks, y=accuracy, color=Type)) +
11131115
labs(x = "Number of Irrelevant Predictors", y = "Accuracy") +
1114-
scale_color_discrete(labels= c("Tuned K", "K = 3"))
1116+
scale_color_discrete(labels= c("Tuned K", "K = 3")) +
1117+
theme(text = element_text(size = 16))
11151118
11161119
plt_irrelevant_nghbrs
11171120
```
@@ -1339,11 +1342,12 @@ where the elbow occurs, and whether adding a variable provides a meaningful incr
13391342
> part of tuning your classifier, you *cannot use your test data* for this
13401343
> process!
13411344
1342-
```{r 06-fwdsel-3, echo = FALSE, warning = FALSE, fig.retina = 2, out.width = "75%", fig.cap = "Estimated accuracy versus the number of predictors for the sequence of models built using forward selection."}
1345+
```{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."}
13431346
fwd_sel_accuracies_plot <- accuracies |>
13441347
ggplot(aes(x = size, y = accuracy)) +
13451348
geom_line() +
1346-
labs(x = "Number of Predictors", y = "Estimated Accuracy")
1349+
labs(x = "Number of Predictors", y = "Estimated Accuracy") +
1350+
theme(text = element_text(size = 18))
13471351
13481352
fwd_sel_accuracies_plot
13491353
```

0 commit comments

Comments
 (0)