Class: DNN::Activations::IdentityMSE
Instance Method Summary
collapse
#build, #built?, #initialize, #prev_layer, #shape, #to_hash
Instance Method Details
#backward(y) ⇒ Object
77
78
79
|
# File 'lib/dnn/core/activations.rb', line 77
def backward(y)
@out - y
end
|
#forward(x) ⇒ Object
73
74
75
|
# File 'lib/dnn/core/activations.rb', line 73
def forward(x)
@out = x
end
|
#loss(y) ⇒ Object
81
82
83
84
|
# File 'lib/dnn/core/activations.rb', line 81
def loss(y)
batch_size = y.shape[0]
0.5 * ((@out - y)**2).sum / batch_size + ridge
end
|