# L1 and L2 Loss Function

L1 and L2 are two loss functions in machine learning which are used to minimize the error.

**L1 Loss function stands for Least Absolute Deviations.** Also known as LAD.\
&#x20;$$L1LossFunction = \sum\_{i=1}^n |y\_{true}-y\_{predicted}|$$&#x20;

\
**L2 Loss function stands for Least Square Errors.** Also known as LS.\
&#x20;$$L2LossFunction = \sum\_{i=1}^n (y\_{true}-y\_{predicted})^2$$&#x20;

{% embed url="<https://afteracademy.com/blog/what-are-l1-and-l2-loss-functions>" %}


---

# 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://ai.nuhil.net/machine-learning/l1-and-l2-loss-function.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.
