# Overfitting vs Underfitting

![Source: Sagar Sharma / Towards Data Science](https://2327526407-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LvBP1svpACTB1R1x_U4%2F-LvNWUoWieQqaGmU_gl9%2F-LvNoby-llz4QzAK15nL%2Fimage.png?alt=media\&token=41720ce9-bb66-4419-9bd8-640abf1fc415)

These terms describe two opposing extremes which both result in poor performance. &#x20;

**Overfitting** refers to a model that was trained too much on the particulars of the training data (when the model learns the noise in the dataset).  A model that is overfit will not perform well on new, unseen data.  Overfitting is arguably the most common problem in applied machine learning and is especially troublesome because a model that appears to be highly accurate will actually perform poorly in the wild.

**Underfitting** typically refers to a model that has not been trained sufficiently. This could be due to insufficient training time or a model that was simply not trained properly.  A model that is underfit will perform poorly on the training data as well as new, unseen data alike.

Both underfitting and overfitting will yield poor performance -- the sweet spot is in between these two extremes.  As the number of training iterations increases, the parameters of the model are updated and the curve goes from underfitting to optimal to overfitting. &#x20;

The optimal state is is referred to as **generalization**. This is where the model performs well on both training data and new data not seen during the training process.


---

# 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://machine-learning.paperspace.com/wiki/overfitting-vs-underfitting.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.
