Skip to content

Commit 8bdc75e

Browse files
more uniformization
1 parent 547ed73 commit 8bdc75e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/classification2.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ The overall workflow for performing K-nearest neighbors classification using `ti
12731273
In these last two chapters, we focused on the K-nearest neighbors algorithm,
12741274
but there are many other methods we could have used to predict a categorical label.
12751275
All algorithms have their strengths and weaknesses, and we summarize these for
1276-
the $K$-NN here.
1276+
the K-NN here.
12771277

12781278
**Strengths:** K-nearest neighbors classification
12791279

@@ -1329,7 +1329,7 @@ cancer_irrelevant |>
13291329
select(Class, Smoothness, Concavity, Perimeter, Irrelevant1, Irrelevant2)
13301330
```
13311331

1332-
Next, we build a sequence of $K$-NN classifiers that include `Smoothness`,
1332+
Next, we build a sequence of K-NN classifiers that include `Smoothness`,
13331333
`Concavity`, and `Perimeter` as predictor variables, but also increasingly many irrelevant
13341334
variables. In particular, we create 6 data sets with 0, 5, 10, 15, 20, and 40 irrelevant predictors.
13351335
Then we build a model, tuned via 5-fold cross-validation, for each data set.
@@ -1485,7 +1485,7 @@ In particular, you
14851485
2. tune each one using cross-validation, and
14861486
3. pick the subset of predictors that gives you the highest cross-validation accuracy.
14871487

1488-
Best subset selection is applicable to any classification method ($K$-NN or otherwise).
1488+
Best subset selection is applicable to any classification method (K-NN or otherwise).
14891489
However, it becomes very slow when you have even a moderate
14901490
number of predictors to choose from (say, around 10). This is because the number of possible predictor subsets
14911491
grows very quickly with the number of predictors, and you have to train the model (itself
@@ -1584,7 +1584,7 @@ one over increasing predictor set sizes
15841584
and another to check which predictor to add in each round (where you see `for (j in 1:length(names))` below).
15851585
For each set of predictors to try, we construct a model formula,
15861586
pass it into a `recipe`, build a `workflow` that tunes
1587-
a $K$-NN classifier using 5-fold cross-validation,
1587+
a K-NN classifier using 5-fold cross-validation,
15881588
and finally records the estimated accuracy.
15891589

15901590
```{r 06-fwdsel-2-seed, warning = FALSE, echo = FALSE, message = FALSE}

0 commit comments

Comments
 (0)