Skip to content

Commit b951287

Browse files
committed
changing seed for cv example in section 6.6.2
1 parent fb1dc8e commit b951287

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

classification2.Rmd

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,11 @@ automatically. We set the `strata` argument to the categorical label variable
653653
(here, `Class`) to ensure that the training and validation subsets contain the
654654
right proportions of each category of observation.
655655

656+
```{r 06-vfold-seed, echo = FALSE, warning = FALSE, message = FALSE}
657+
# hidden seed
658+
set.seed(14)
659+
```
660+
656661
```{r 06-vfold}
657662
cancer_vfold <- vfold_cv(cancer_train, v = 5, strata = Class)
658663
cancer_vfold
@@ -689,9 +694,9 @@ of the classifier's validation accuracy across the folds. You will find results
689694
related to the accuracy in the row with `accuracy` listed under the `.metric` column.
690695
You should consider the mean (`mean`) to be the estimated accuracy, while the standard
691696
error (`std_err`) is a measure of how uncertain we are in the mean value. A detailed treatment of this
692-
is beyond the scope of this chapter; but roughly, if your estimated mean is 0.88 and standard
693-
error is 0.02, you can expect the *true* average accuracy of the
694-
classifier to be somewhere roughly between 86% and 90% (although it may
697+
is beyond the scope of this chapter; but roughly, if your estimated mean is `r round(filter(collect_metrics(knn_fit), .metric == "accuracy")$mean,2)` and standard
698+
error is `r round(filter(collect_metrics(knn_fit), .metric == "accuracy")$std_err,2)`, you can expect the *true* average accuracy of the
699+
classifier to be somewhere roughly between `r (round(filter(collect_metrics(knn_fit), .metric == "accuracy")$mean,2) - round(filter(collect_metrics(knn_fit), .metric == "accuracy")$std_err,2))*100`% and `r (round(filter(collect_metrics(knn_fit), .metric == "accuracy")$mean,2) + round(filter(collect_metrics(knn_fit), .metric == "accuracy")$std_err,2))*100`% (although it may
695700
fall outside this range). You may ignore the other columns in the metrics data frame,
696701
as they do not provide any additional insight.
697702
You can also ignore the entire second row with `roc_auc` in the `.metric` column,

0 commit comments

Comments
 (0)