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