Exercise

# Validation set approach

In the chapter on linear regression, you fit a linear regression model that explains cats' heart weights by their body weights.
The job interviewer asks you to **evaluate how good your model is**.

To answer this question, you need to derive predictions that can be compared against the actual values.
In the **validation set approach**, you divide your data into two parts.

To do that, you can first take a **sample** of, say, 80% row numbers. Use the chosen row numbers to subset the train set. The rest of the data frame can be used for testing.

Remember that:

```
rows <- c(1, 3)
df[-rows, ]
```

subsets **all but** the first and the third row.

The `cats`

dataset is available in your environment.

Instructions 1/3

**undefined XP**

- Randomly choose 80% (rounded) of the row numbers of the
`cats`

dataset.