Class: DNN::Activations::IdentityMSE
Instance Method Summary
collapse
#build, #built?, #initialize, #prev_layer, #shape, #to_hash
Instance Method Details
#backward(y) ⇒ Object
149
150
151
|
# File 'lib/dnn/core/activations.rb', line 149
def backward(y)
@out - y
end
|
#forward(x) ⇒ Object
145
146
147
|
# File 'lib/dnn/core/activations.rb', line 145
def forward(x)
@out = x
end
|
#loss(y) ⇒ Object
153
154
155
156
|
# File 'lib/dnn/core/activations.rb', line 153
def loss(y)
batch_size = y.shape[0]
0.5 * ((@out - y)**2).sum / batch_size + ridge
end
|