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