Class: DNN::Losses::MeanSquaredError

Inherits:
Loss
  • Object
show all
Defined in:
lib/dnn/core/losses.rb

Instance Method Summary collapse

Methods inherited from Loss

#clean, from_hash, #load_hash, #loss, #regularizers_backward, #regularizers_forward, #to_hash

Instance Method Details

#backward(y, t) ⇒ Object



71
72
73
# File 'lib/dnn/core/losses.rb', line 71

def backward(y, t)
  y - t
end

#forward(y, t) ⇒ Object



67
68
69
# File 'lib/dnn/core/losses.rb', line 67

def forward(y, t)
  0.5 * ((y - t)**2).mean(0).sum
end