Class: DNN::Activations::IdentityMSE
Instance Method Summary
collapse
#build, #built?, #initialize, #prev_layer, #shape, #to_hash
Instance Method Details
#backward(y) ⇒ Object
159
160
161
|
# File 'lib/dnn/core/activations.rb', line 159
def backward(y)
@out - y
end
|
#forward(x) ⇒ Object
155
156
157
|
# File 'lib/dnn/core/activations.rb', line 155
def forward(x)
@out = x
end
|
#loss(y) ⇒ Object
163
164
165
166
|
# File 'lib/dnn/core/activations.rb', line 163
def loss(y)
batch_size = y.shape[0]
0.5 * ((@out - y)**2).sum / batch_size + lasso + ridge
end
|