Class: DNN::Activations::IdentityMAE
Instance Method Summary
collapse
#build, #built?, #initialize, #prev_layer, #shape, #to_hash
Instance Method Details
#backward(y) ⇒ Object
175
176
177
178
179
180
|
# File 'lib/dnn/core/activations.rb', line 175
def backward(y)
dout = @out - y
dout[dout >= 0] = 1
dout[dout < 0] = -1
dout
end
|
#forward(x) ⇒ Object
171
172
173
|
# File 'lib/dnn/core/activations.rb', line 171
def forward(x)
@out = x
end
|
#loss(y) ⇒ Object
182
183
184
185
|
# File 'lib/dnn/core/activations.rb', line 182
def loss(y)
batch_size = y.shape[0]
(@out - y).abs.sum / batch_size + lasso + ridge
end
|