Class: GRX::Loss::MAELoss

Inherits:
Object
  • Object
show all
Defined in:
lib/grx/loss.rb

Overview

MAELoss — Mean Absolute Error L = mean(|pred - target|)

Instance Method Summary collapse

Instance Method Details

#call(pred, target) ⇒ Object

Raises:



21
22
23
24
# File 'lib/grx/loss.rb', line 21

def call(pred, target)
  raise ShapeError, "Shapes incompatibles" if pred.shape != target.shape
  (pred - target).abs.mean
end