l2_loss#
- class braintools.metric.l2_loss(predictions, targets=None)#
Calculates the L2 loss for a set of predictions.
Note: the 0.5 term is standard in “Pattern Recognition and Machine Learning” by Bishop, but not “The Elements of Statistical Learning” by Tibshirani.
References
[Chris Bishop, 2006](https://bit.ly/3eeP0ga)
- Parameters:
predictions (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – a vector of arbitrary shape […].targets (
Array|ndarray|bool|number|bool|int|float|complex|Quantity|None) – a vector with shape broadcastable to that of predictions; if not provided then it is assumed to be a vector of zeros.
- Return type:
Array|ndarray|bool|number|bool|int|float|complex|Quantity- Returns:
elementwise squared differences, with same shape as predictions.