Compute the NormalizedRootMeanSquaredError metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute NormalizedRootMeanSquaredError, or asks how to score with NormalizedRootMeanSquaredError.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add qhjqhj00/research-skills-pool --skill normalizedrootmeansquarederror --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Normalizedrootmeansquarederror?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-normalizedrootmeansquarederror)More formats (shields.io, HTML) on the badges page.
---
name: normalizedrootmeansquarederror
description: Compute the NormalizedRootMeanSquaredError metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute NormalizedRootMeanSquaredError, or asks how to score with NormalizedRootMeanSquaredError.
metadata:
skill_kind: metric
source_lib: torchmetrics
import_path: torchmetrics.NormalizedRootMeanSquaredError
source: library_introspection
---
# normalizedrootmeansquarederror
> Metric `NormalizedRootMeanSquaredError` from `torchmetrics` (torchmetrics.NormalizedRootMeanSquaredError)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with NormalizedRootMeanSquaredError, or
mentions `torchmetrics.NormalizedRootMeanSquaredError` directly, or wants the standard torchmetrics implementation.
## Reference signature
```python
from torchmetrics import NormalizedRootMeanSquaredError
# NormalizedRootMeanSquaredError(normalization: Literal['mean', 'range', 'std', 'l2'] = 'mean', num_outputs: int = 1, **kwargs: Any) -> None
```
## Library docstring
```
Calculates the `Normalized Root Mean Squared Error`_ (NRMSE) also know as scatter index.
The metric is defined as:
.. math::
\text{NRMSE} = \frac{\text{RMSE}}{\text{denom}}
where RMSE is the root mean squared error and `denom` is the normalization factor. The normalization factor can be
either be the mean, range, standard deviation or L2 norm of the target, which can be set using the `normalization`
argument.
As input to ``forward`` and ``update`` the metric accepts the following input:
- ``preds`` (:class:`~torch.Tensor`): Predictions from model
- ``target`` (:class:`~torch.Tensor`): Ground truth values
As output of ``forward`` and ``compute`` the metric returns the following output:
- ``nrmse`` (:class:`~torch.Tensor`): A tensor with the mean squared error
Args:
normalization: type of normalization to be applied. Choose from "mean", "range", "std", "l2" which corresponds
to normalizing the RMSE by the mean of the target, the range of the target, the standard deviation of the
target or the L2 norm of the target.
num_outputs: Number of outputs in multioutput setting
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Example::
Single output normalized root mean squared error computation:
>>> import torch
>>> from torchmetrics import NormalizedRootMeanSquaredError
>>> target = torch.tensor([2.5, 5.0, 4.0, 8.0])
>>> preds = torch.tensor([3.0, 5.0, 2.5, 7.0])
>>> nrmse = NormalizedRootMeanSquaredError(normalization="mean")
>>> nrmse(preds, target)
tensor(0.1919)
>>> nrmse = NormalizedRootMeanSquaredError(normalization="range")
>>> nrmse(preds, target)
tensor(0.1701)
Example::
Multioutput normalized root mean squared error computation:
>>> import torch
>>> from torchmetrics import NormalizedRootMeanSquaredError
>>> preds = torch.tensor([[0., 1], [2, 3], [4, 5], [6, 7]])
>>> target = torch.tensor([[0., 1], [3, 3], [4, 5], [8, 9]])
>>> nrmse = NormalizedRootMeanSquaredError(num_outputs=2)
>>> nrmse(preds, target)
tensor([0.2981, 0.2222])
```
## Quick recipe
```python
import torchmetrics as _m
score = _m.NormalizedRootMeanSquaredError(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)`.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!