CalcWorldHub
Free online calculator · no signup

Log-cosh loss calculator

Compute mean log-cosh loss for four signed residuals, with stable evaluation for large residual magnitudes.

A better way to figure it out
Clear
inputs.
∑
Clear result · useful details
Free calculatorNo signup ✓
Log-cosh loss calculator — Residual 1, Residual 2, Residual 3 and calculation method
Log-cosh loss calculator: inputs and calculation method.

How to use this calculator

Compute mean log-cosh loss for four signed residuals, with stable evaluation for large residual magnitudes.

  1. Enter Residual 1, Residual 2, Residual 3, Residual 4. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

How the Log-cosh loss calculator works

Compute mean log-cosh loss for four signed residuals, with stable evaluation for large residual magnitudes.

Inputs and units

  • Residual 1: First observed-minus-predicted residual, in the chosen common scale.
  • Residual 2: Second signed residual; negative values are valid.
  • Residual 3: Third signed residual, with the same scaling as the others.
  • Residual 4: Fourth signed residual; all four contribute equally.

Formula and method

loss = Σ ln(cosh(eᵢ)) / 4; for large |e| use |e| + ln(1 + exp(−2|e|)) − ln(2)

Worked example

Residuals 1.2, −0.8, 2, and 1 give log-cosh terms about 0.593689, 0.290754, 1.325003, and 0.433781; their mean is 0.660807.

Interpreting the result

Near zero, each term behaves like half the squared residual; for large magnitudes its growth is approximately linear. Reversing a residual sign does not change its contribution.

Assumptions and limits

The residual scale matters: use consistently scaled or normalized errors when comparing models. This is a four-observation mean, not a sum or an optimizer.

Sources and method

Frequently asked questions

Why allow a negative residual?

Log-cosh is an even function: ln(cosh(−e)) = ln(cosh(e)). Direction does not change this loss.

Why not calculate cosh directly for every input?

Direct cosh can overflow for a finite residual such as 1,000. The equivalent log-domain expression retains a finite loss.

How do I use the Log-cosh loss calculator?

Enter Residual 1, Residual 2, Residual 3, Residual 4. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Log-cosh loss?

Residuals 1.2, −0.8, 2, and 1 give log-cosh terms about 0.593689, 0.290754, 1.325003, and 0.433781; their mean is 0.660807.

What does the Log-cosh loss calculator calculate?

Compute mean log-cosh loss for four signed residuals, with stable evaluation for large residual magnitudes.