# Training and Loss

Training a model just means reducing **loss** in a process called **empirical risk minimization**. **Loss** is a number indicating how bad your model predicted when compared to a single known example.

### Squared Loss

Also **L2 loss**

```
= the square of the difference between the label and the prediction
= (observation - prediction(x))2
= (y - y')2
```

Also **Mean squared error (MSE)**&#x20;

$$
MSE = 1/N \sum(y-prediction(x))^2
$$

Where:\
\&#xNAN;*(x,y)* is an example in which x is the set of features and y is the label\
\&#xNAN;*prediction(x)* is a function of the weights and bias in combination with the set of features *x*\
\&#xNAN;*D* is a data set containing many labeled examples, which are *(x,y)* pairs\
\&#xNAN;*N* is the number of examples in *D*


---

# 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://gitbook.nicacton.com/software-engineering/machine-learning/training-and-loss.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.
