Add needed packages to model-assess

This commit is contained in:
hadley 2015-12-07 09:06:19 -06:00
parent 5ae3b64a48
commit c18b4a4f40
1 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,13 @@ title: Models assessment
output: bookdown::html_chapter
---
```{r setup, include=FALSE}
library(purrr)
set.seed(1014)
options(digits = 3)
```
## Multiple models
A natural application of `map2()` is handling test-training pairs when doing model evaluation. This is an important modelling technique: you should never evaluate a model on the same data it was fit to because it's going to make you overconfident. Instead, it's better to divide the data up and use one piece to fit the model and the other piece to evaluate it. A popular technique for this is called k-fold cross validation. You randomly hold out x% of the data and fit the model to the rest. You need to repeat this a few times because of random variation.