log_cosh#
- class braintools.metric.log_cosh(predictions, targets=None)#
Calculates the log-cosh loss for a set of predictions.
log(cosh(x)) is approximately (x**2) / 2 for small x and abs(x) - log(2) for large x. It is a twice differentiable alternative to the Huber loss.
References
[Chen et al, 2019](https://openreview.net/pdf?id=rkglvsC9Ym)
- 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:
the log-cosh loss, with same shape as predictions.