#### Definition

- The root mean squared error (rmse) is a metric for determining the similarity between two sets.
- It is similar to the mean absolute error, except with a couple of extra steps:
- Each absolute error is squared before being summed.
- The final result (mean squared error) is square-rooted before being returned.

#### Example

- Find the root square mean error of the following two sets of numbers:
`S`_{1} = [2, 5, 9, 2]
S_{2} = [6, 3, 6, 1]

- First we calculate the differences between these numbers:
```
D = [2 - 6, 5 - 3, 9 - 6, 2 - 1]
D = [-4, 2, 3, 1]
```

- Now we square them:
`D = [-4`^{2}, 2^{2}, 3^{2}, 1^{2}]
D = [16, 4, 9, 1]

- next we find the mean of these numbers:
```
mean = (16 + 4 + 9 + 1) / 4
mean = 30 / 4
mean = 7.5
```

- finally we square root the mean:
```
rmse = sqrt(mean)
rmse = 2.74 to 3 s.f.
```

#### Mathematical Definition

LaTeX formula:`rmse = \sqrt{(\frac{1}{n})\sum_{i=1}^{n}(y_{i} - x_{i})^{2}}`

#### code (Python)

```
import sklearn.metrics
import math
S1 = [2, 5, 9, 2]
S2 = [6, 3, 6, 1]
mse = sklearn.metrics.mean_squared_error(S1, S2)
rmse = math.sqrt(mse)
print(rmse)
```