Compute the root_mean_squared_error metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute root_mean_squared_error, or asks how to score with root_mean_squared_error.
Installs into .claude/skills of the current project.
Are you the author of Root Mean Squared Error?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-root-mean-squared-error)
---
name: root-mean-squared-error
description: Compute the root_mean_squared_error metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute root_mean_squared_error, or asks how to score with root_mean_squared_error.
metadata:
skill_kind: metric
source_lib: scikit-learn
import_path: sklearn.metrics.root_mean_squared_error
source: library_introspection
---
# root-mean-squared-error
> Metric `root_mean_squared_error` from `scikit-learn` (sklearn.metrics.root_mean_squared_error)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with root_mean_squared_error, or
mentions `sklearn.metrics.root_mean_squared_error` directly, or wants the standard scikit-learn implementation.
## Reference signature
```python
from sklearn.metrics import root_mean_squared_error
# root_mean_squared_error(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')
```
## Library docstring
```
Root mean squared error regression loss.
Read more in the :ref:`User Guide <mean_squared_error>`.
.. versionadded:: 1.4
Parameters
----------
y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)
Ground truth (correct) target values.
y_pred : array-like of shape (n_samples,) or (n_samples, n_outputs)
Estimated target values.
sample_weight : array-like of shape (n_samples,), default=None
Sample weights.
multioutput : {'raw_values', 'uniform_average'} or array-like of shape (n_outputs,), default='uniform_average'
Defines aggregating of multiple output values.
Array-like value defines weights used to average errors.
'raw_values' :
Returns a full set of errors in case of multioutput input.
'uniform_average' :
Errors of all outputs are averaged with uniform weight.
Returns
-------
loss : float or ndarray of floats
A non-negative floating point value (the best value is 0.0), or an
array of floating point values, one for each individual target.
Examples
--------
>>> from sklearn.metrics import root_mean_squared_error
>>> y_true = [3, -0.5, 2, 7]
>>> y_pred = [2.5, 0.0, 2, 8]
>>> root_mean_squared_error(y_true, y_pred)
0.612...
>>> y_true = [[0.5, 1],[-1, 1],[7, -6]]
>>> y_pred = [[0, 2],[-1, 2],[8, -5]]
>>> root_mean_squared_error(y_true, y_pred)
0.822...
```
## Quick recipe
```python
import sklearn.metrics as _m
score = _m.root_mean_squared_error(y_true, y_pred)
```
## Don'ts
- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.