Class: GRX::Loss::MSELoss

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

Overview

MSELoss — Mean Squared Error L = mean((pred - target)^2) → retorna Float

Instance Method Summary collapse

Instance Method Details

#call(pred, target) ⇒ Object

Raises:



10
11
12
13
# File 'lib/grx/loss.rb', line 10

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