log_cosh
std.loss.log_cosh · Level L1Log-cosh loss, in a form that never overflows. Calls abs.
mean( |d| + log(1 + e^(−2|d|)) − log 2 ), d = y − t
Signature
log_cosh(y: f64[n], t: f64[n]) → f64[]
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks a call to another library function; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size.
- Agrees with the reference
np.mean(np.log(np.cosh(y - t)))to 80 digits (100-digit arithmetic), on all 40 test cases. - All 40 float64 results inside the running error bound; the closest uses 18% of it.
- Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
- correctly rounded (the float64 nearest the exact value)
- 40%
- bit-equal to the NumPy formula in float64
- 38%
- largest error, in units in the last place
- 7.5e+15
Large ulp counts appear only where cancellation drives a result toward zero; the absolute error is still inside the bound.
Note
log 2 enters as its nearest float64, so the graph equals log cosh up to that one constant's rounding; the verification accounts for it.
Identity
sha256:74a5472ebe8b195d84e46ea10efbdc6a8df824144fc0faf920a67c23e1d85c8cThe semantic hash of the graph. It changes when the program changes, and never when only its documentation does.