@@ -170,6 +170,7 @@ total set of variables per image in this data set is:
170
170
11 . Symmetry: how similar the nucleus is when mirrored
171
171
12 . Fractal Dimension: a measurement of how "rough" the perimeter is
172
172
173
+ \pagebreak
173
174
174
175
Below we use ` glimpse ` \index{glimpse} to preview the data frame. This function can
175
176
make it easier to inspect the data when we have a lot of columns,
@@ -192,7 +193,7 @@ glimpse(cancer)
192
193
```
193
194
194
195
Recall that factors have what are called "levels", which you can think of as categories. We
195
- can verify the levels of the ` Class ` column by using the ` levels ` \index{levels}\index{factor!levels} function.
196
+ can verify the levels of the ` Class ` column by using the ` levels ` \index{levels}\index{factor!levels} function.
196
197
This function should return the name of each category in that column. Given
197
198
that we only have two different values in our ` Class ` column (B for benign and M
198
199
for malignant), we only expect to get two names back. Note that the ` levels ` function requires a * vector* argument;
@@ -534,7 +535,7 @@ kable(math_table, booktabs = TRUE,
534
535
```
535
536
536
537
The result of this computation shows that 3 of the 5 nearest neighbors to our new observation are
537
- malignant (` M ` ); since this is the majority, we classify our new observation as malignant.
538
+ malignant ("M" ); since this is the majority, we classify our new observation as malignant.
538
539
These 5 neighbors are circled in Figure \@ ref(fig:05-multiknn-3).
539
540
540
541
``` {r 05-multiknn-3, echo = FALSE, fig.height = 3.5, fig.width = 4.5, fig.cap="Scatter plot of concavity versus perimeter with 5 nearest neighbors circled."}
@@ -582,7 +583,6 @@ three predictors.
582
583
new_obs_Perimeter <- 0
583
584
new_obs_Concavity <- 3.5
584
585
new_obs_Symmetry <- 1
585
-
586
586
cancer |>
587
587
select(ID, Perimeter, Concavity, Symmetry, Class) |>
588
588
mutate(dist_from_new = sqrt((Perimeter - new_obs_Perimeter)^2 +
0 commit comments