LogCoshLossMetric<T>

Models & Types · AiDotNet.Evaluation.Metrics.Regression

Computes Log-Cosh Loss: mean of log(cosh(y - ŷ)).

Implements: IRegressionMetric<T>

For Beginners

Log-Cosh loss combines benefits of MSE and MAE:

  • Behaves like MAE for large errors (robust to outliers)
  • Behaves like MSE for small errors (smooth gradient)
  • Always positive and convex
  • Has continuous second derivative (unlike Huber)

How It Works

Log-Cosh = (1/N) × Σ log(cosh(y - ŷ))

Advantages over alternatives:

  • vs MSE: More robust to outliers
  • vs MAE: Smoother gradient near zero
  • vs Huber: No hyperparameter to tune

Constructors

Constructor Summary
LogCoshLossMetric()

Properties

Property Summary
MetricDirection Direction { get; }
T MaxValue { get; }
T MinValue { get; }
bool RequiresProbabilities { get; }
bool SupportsMultiClass { get; }
string Category { get; }
string Description { get; }
string Name { get; }

Methods

Method Summary
MetricWithCI<T> ComputeWithCI(ReadOnlySpan<T> predictions, ReadOnlySpan<T> actuals, ConfidenceIntervalMethod ciMethod, double confidenceLevel, int bootstrapSamples, int? randomSeed)
T Compute(ReadOnlySpan<T> predictions, ReadOnlySpan<T> actuals)