Deviation Metrics
Shippingarray_deviationSix error/deviation metrics between two arrays: L1, L2, L∞, MAE, MSE, RMSE
Signature
Inputs
aArrayrequired— First array (e.g. reference / truth), flattened to 1-D.bArrayrequired— Second array (e.g. prediction), flattened to 1-D.
Outputs
l1Scalar— $L_1$ norm of the difference, $\sum |a_i - b_i|$.l2Scalar— $L_2$ (Euclidean) norm of the difference.linfScalar— $L_\infty$ (max absolute) deviation.mean_abs_errScalar— Mean absolute error (MAE).mean_sq_errScalar— Mean squared error (MSE).root_mean_sq_errScalar— Root-mean-square error (RMSE).
Description
Deviation Metrics compares two equal-length arrays element-wise and emits six standard error/distance measures at once — three norms of the difference vector and three averaged errors:
- (Manhattan)
- (Euclidean)
- (worst-case)
- MAE
- MSE
- RMSE
Both inputs are flattened to 1-D, so shape is irrelevant as long as the element counts match. The node is stateless — use it to score a model's fit against ground truth, or to quantify the gap between two signals.
Mathematics
Examples
Scoring a prediction
With a = [1,2,3] (truth) and b = [1,2,5] (prediction), the only error is at index 2 (): l1 , linf , l2 , mean_abs_err , mean_sq_err , root_mean_sq_err .
Applications
- Scoring regression / reconstruction quality against ground truth (RMSE, MAE).
- Worst-case tolerance checks via the $L_\infty$ deviation.
- Comparing a filtered or compressed signal to its original.
Neat
One evaluation yields both the raw difference-vector norms ($L_1/L_2/L_\infty$) and their per-sample averages (MAE/MSE/RMSE), so scale-dependent and scale-independent views come free together.
$L_\infty$ surfaces the single worst point — invaluable when an average metric hides a localized spike.