# Model Validation

K-fold cross-validationis a method of model validation. It consists of dividing the dataset into k subsets of roughly equal size and training k models, excluding a different subset each time. The excluded subsets are used as the validation set and the union of all the remaining subsets as the training set.

**For each set of parameters you want to validate, train all k models and calculate the mean error across all k models. Finally, you choose the set of parameters giving you the smallest average error.**

Gollapudi - practical machine learning


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nag-9-s.gitbook.io/machine-learning/learning/evaluation-metrics/model-validation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
